Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
int subarrayCount(vector<int>& arr){
int n = arr.size();
int cnt=1, 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++17 (G++ 13.2.0)
- Submit At
- 2024-03-27 17:38:38
- Judged At
- 2024-11-11 03:37:32
- Judged By
- Score
- 10
- Total Time
- 1ms
- Peak Memory
- 324.0 KiB