/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 536.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 1ms 532.0 KiB
#4 Wrong Answer 1ms 532.0 KiB
#5 Accepted 1ms 340.0 KiB
#6 Accepted 1ms 532.0 KiB
#7 Wrong Answer 1ms 528.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int N = 1e7 + 9;
int a[N];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    ll sum = 0;
    ll cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += a[i];
        if (sum % 2 == 0)
        {
            cnt++;
            sum = 0;
        }
    }
    if (cnt == 0)
    {
        cout << "-1\n";
    }
    else
    {
        cout << cnt << '\n';
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1042 Array partition
Contest
TLE_Headquarters - round #1
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-27 16:46:34
Judged At
2024-11-11 03:38:06
Judged By
Score
30
Total Time
2ms
Peak Memory
536.0 KiB