Submission #963023

#TimeUsernameProblemLanguageResultExecution timeMemory
963023happy_nodeRemittance (JOI19_remittance)C++17
0 / 100
1 ms2648 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MX=1e6+5; int N; ll A[MX], B[MX]; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin>>N; for(int i=0;i<N;i++) cin>>A[i]>>B[i]; for(int k=0;k<51;k++) { for(int i=N-1;i>=0;i--) { if(B[i]>A[i]) { ll d=B[i]-A[i]; if(i==0) { B[N-1]+=2*d; } else { B[i-1]+=2*d; } B[i]=A[i]; } } } bool ok=1; for(int i=0;i<N;i++) ok&=A[i]==B[i]; cout<<(ok?"Yes":"No")<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...