Submission #952976

#TimeUsernameProblemLanguageResultExecution timeMemory
952976Alexabcde1Remittance (JOI19_remittance)C++14
0 / 100
1 ms2648 KiB
#include<bits/stdc++.h> #define f first #define s second using namespace std; long long n; long long a[1000005],b[1000005]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; for (int i=0;i<n;i++) cin>>a[i]>>b[i]; long long cnt=50; while (cnt--){ for (int i=0;i<n;i++){ if (a[i]>b[i]){ long long give=(a[i]-b[i])/2; a[i]-=give*2; a[(i+1)%n]+=give; } } } for (int i=0;i<n;i++){ if (a[i]!=b[i]) { cout<<"No"<<endl; return 0; } } cout<<"Yes"<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...