Submission #655745

#TimeUsernameProblemLanguageResultExecution timeMemory
655745piOOERemittance (JOI19_remittance)C++17
55 / 100
1058 ms27656 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]; } for (int _ = 0; _ < 200; ++_) { for (int i = 0; i < n; ++i) { if (a[i] > b[i]) { int x = (a[i] - b[i] + !!b[i]) / 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...