Submission #797112

#TimeUsernameProblemLanguageResultExecution timeMemory
797112ymmRemittance (JOI19_remittance)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) typedef long long ll; using namespace std; const int N = 1e6+10; ll a[N], b[N]; int n; int main() { cin.tie(0) -> sync_with_stdio(false); cin >> n; Loop (i,0,n) cin >> a[i] >> b[i]; Loop (_,0,10000) { Loop (i,0,n) { if (a[i] <= 1) continue; ll x = max(0ll, (a[i] - b[i] + 1)/2); a[i] -= 2*x; a[(i+1) == n? 0: i+1] += x; } } bool ans = 1; Loop (i,0,n) ans &= a[i] == b[i]; cout << (ans? "Yes": "No") << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...