You are viewing a single comment's thread. Return to all comments →
int main() { int odd = 0, even = 0; int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) { cin >> a[i]; if(a[i]%2 == 0) even++; else odd++; } if(n == 1 & odd == 1) { cout << -1; return 0; } cout << min(odd%2, odd%2 + even%2); return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Parity Game
You are viewing a single comment's thread. Return to all comments →