Wrong Answer
Code
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin>>n;
vector<int>A(n);
for (int i=0;i<n; i++) {
cin>>A[i];
}
int even=0,odd=0;
for (int num : A) {
if (num%2==0) {
even++;
} else {
odd++;
}
}
if (even%2==1) {
cout<<-1<<endl;
} else {
cout<<odd+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 17:21:40
- Judged At
- 2024-11-11 03:37:37
- Judged By
- Score
- 10
- Total Time
- 2ms
- Peak Memory
- 396.0 KiB