Submission #335095

#TimeUsernameProblemLanguageResultExecution timeMemory
335095Mo_TOI_I_am_GarbageRemittance (JOI19_remittance)C++14
0 / 100
1 ms364 KiB
#include<bits/stdc++.h> using namespace std; int main() { int a; cin >> a; pair<int, int> arr[a + 50]; for(int i=0; i < a; i ++) cin >> arr[i].first >> arr[i].second; while(true) { bool yes = false; for(int i=0; i < a; i ++) { if(arr[i].first < arr[i].second + 2) continue; int t = (arr[i].first - arr[i].second) / 2; arr[i].first -= t * 2; if(i == a - 1) arr[0].first += t; else arr[i + 1].first += t; yes = true; } if(!yes) break; } bool yes1 = true, yes2 = true, yes3 = false; for(int i=0; i < a; i ++) { if(arr[i].first != arr[i].second) yes1 = false; if(arr[i].first != arr[i].second + 1) yes2 = false; if(arr[i].first >= 2) yes2 = true; } if(yes1 || (yes2 && yes3)) cout << "Yes"; else cout << "No"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...