Submission #655746

#TimeUsernameProblemLanguageResultExecution timeMemory
655746piOOERemittance (JOI19_remittance)C++17
100 / 100
359 ms28652 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; _ < 30; ++_) { 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...