/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 524.0 KiB
#3 Accepted 1ms 320.0 KiB
#4 Accepted 1ms 324.0 KiB
#5 Accepted 1ms 320.0 KiB
#6 Accepted 1ms 320.0 KiB
#7 Accepted 1ms 532.0 KiB
#8 Accepted 1ms 532.0 KiB
#9 Accepted 32ms 1.285 MiB
#10 Accepted 32ms 1.066 MiB
#11 Accepted 31ms 1.168 MiB
#12 Accepted 1ms 532.0 KiB
#13 Accepted 1ms 532.0 KiB
#14 Accepted 17ms 1.285 MiB
#15 Accepted 17ms 1.293 MiB
#16 Accepted 17ms 1.293 MiB

Code

/*
CODED BY mamudulsakib2019
DATE:-24/03/2024 ; TIME- 17:47 PM
BANGLADESH , SYLHET
*/
#include<bits/stdc++.h>  
using namespace std;
typedef unsigned long long  ll;

int main() {
    ll size;
    cin >> size;

    vector<ll> numbers(size);
    for(ll i = 0; i < size; i++){
        cin >> numbers[i];
    }
    ll evenSumSubarrays = 0, sum = 0;

    for(ll num : numbers){
        sum += num;
        if(sum % 2 == 0){
            evenSumSubarrays++;
            sum = 0;
        }
    }
    if(sum == 0){
        cout << evenSumSubarrays << endl;
    }
    else{
        cout << -1 << endl;
    }

    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 18:06:18
Judged At
2024-11-11 03:37:19
Judged By
Score
100
Total Time
32ms
Peak Memory
1.293 MiB