Submission #655747

#TimeUsernameProblemLanguageResultExecution timeMemory
655747piOOERemittance (JOI19_remittance)C++17
100 / 100
232 ms8276 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; } if (*max_element(b.begin(), b.end()) == 0 && *max_element(a.begin(), a.end()) > 0) { cout << "No\n"; return 0; } for (int _ = 0; _ < 30; ++_) { for (int i = 0; i < n; ++i) { if (a[i] > b[i]) { int x = (a[i] - b[i] + 1) / 2; a[(i + 1) % n] += x; a[i] -= 2 * x; } } } if (a == b) { cout << "Yes"; } else { cout << "No"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...