Submission #134469

#TimeUsernameProblemLanguageResultExecution timeMemory
134469model_codeRemittance (JOI19_remittance)C++17
100 / 100
391 ms16136 KiB
#include <cstdio> #include <vector> using namespace std; int main() { int n; scanf("%d",&n); vector<long long> A(n),B(n); for(int i=0;i<n;i++){ scanf("%lld%lld",&A[i],&B[i]); } bool F,G=false; for(int i=0;i<n;i++){ G|=(B[i]>0); } if(!G){ F=true; for(int i=0;i<n;i++){ F&=(A[i]==0); } } else{ bool loop=true; while(loop){ loop=false; for(int i=0;i<n;i++){ if(A[i]>B[i]){ long long t=(A[i]-B[i]+1)/2; A[i]-=2*t; A[(i+1)%n]+=t; loop=true; } } } F=true; for(int i=0;i<n;i++){ F&=(A[i]==B[i]); } } puts(F?"Yes":"No"); return 0; }

Compilation message (stderr)

remittance.cpp: In function 'int main()':
remittance.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
   ~~~~~^~~~~~~~~
remittance.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&A[i],&B[i]);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...