제출 #574208

#제출 시각아이디문제언어결과실행 시간메모리
574208moday_morningThe Xana coup (BOI21_xanadu)C++17
0 / 100
67 ms3876 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n; cin >> n; vector <pair <int, int> > v(n); for (int i = 0; i < n - 1; i++) { cin >> v[i].first >> v[i].second; } int cnt0 = 0, cnt1 = 0; vector <int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) { cnt0++; } else { cnt1++; } } if (n % 2 == 1) { if (cnt1 == 1) { cout << "impossible\n"; } else if (cnt1 % 2 == 1) { cout << n - 1 << "\n"; } else { cout << "impossible\n"; } } else { if (cnt0 % 2 == 0) { cout << n - 1 << "\n"; } else { cout << "impossible\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...