Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
int subarrayCount(vector<int>& arr){
int n = arr.size();
int cnt=0, evenSum=0;
for(int i=0; i<n; i++){
if(arr[i]%2!=0){
evenSum=0;
}
else{
evenSum++;
cnt += evenSum;
}
}
return cnt;
}
int main(){
int N;
cin>>N;
vector<int> arr(N);
for(int i=0; i<N; i++){
cin>> arr[i];
}
int res = subarrayCount(arr);
cout<<res<<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 17:36:29
- Judged At
- 2024-11-11 03:37:33
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 320.0 KiB