제출 #972470

#제출 시각아이디문제언어결과실행 시간메모리
97247012345678송금 (JOI19_remittance)C++17
0 / 100
1 ms2484 KiB
#include <bits/stdc++.h> using namespace std; const int nx=1e6+5; int n, a[nx], b[nx], lst; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=0; i<n; i++) cin>>a[i]>>b[i]; while (1) { for (int i=0; i<n; i++) { lst++; if (a[i]>b[i]+1) a[(i+1)%n]+=(a[i]-b[i])/2, a[i]-=((a[i]-b[i])/2)*2, lst=0; if (lst==2*n) { for (int j=0; j<n; j++) if (a[j]!=b[j]) return cout<<"No", 0; return cout<<"Yes", 0; } } //cout<<"debug "; //for (int i=0; i<n; i++) cout<<a[i]<<' '; //cout<<'\n'; } } /* 5 0 0 0 0 0 0 0 1 16 0 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...