Submission #1117217

#TimeUsernameProblemLanguageResultExecution timeMemory
1117217Marco_EscandonRemittance (JOI19_remittance)C++11
55 / 100
1040 ms35340 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define x first #define y second ll dx[]={1, 1, 0,-1,-1, -1, 0, 1}; ll dy[]={0, 1, 1, 1, 0, -1,-1,-1}; int main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); ll n; cin>>n; vector<ll> a(n),b(n); for(int i=0; i<n; i++) { cin>>a[i]>>b[i]; } for(int j=0; j<1e5; j++) { for(int i=0; i<n; i++) { if(a[i]>b[i]) { ll t1=(a[i]-b[i]+1)/2; if(t1*2>a[i])t1--; a[i]-=t1*2; a[(i+1)%n]+=t1; } } } if(a!=b) { cout<<"No"; } else cout<<"Yes"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...