Submission #211635

#TimeUsernameProblemLanguageResultExecution timeMemory
211635m3r8Remittance (JOI19_remittance)C++14
100 / 100
380 ms36472 KiB
#include <stdio.h> #define N 1000100 #define ll long long ll A[N]; ll B[N]; int cnt[N]; int main(void){ int n; int nn = 1; int nnn = 1; scanf("%d",&n); for(int i = 0;i<n;i++){ scanf("%lld %lld",&A[i],&B[i]); if(B[i] != 0)nn = 0; if(A[i] != 0)nnn = 0; }; int pos = 1; if(nn && !nnn)pos = 0; if(pos){ int end = 1; while(end){ end = 0; for(int i = 0;i<n;i++){ if(A[i] > B[i]){ ll diff = A[i] - B[i]; if(diff % 2)diff++; if(A[i] >= diff){ end = 1; A[i] -= diff; A[(i+1)%n] += diff/2; }; }; }; }; for(int i = 0;i<n;i++){ if(A[i] != B[i]){ pos = 0; break; }; }; }; if(pos)printf("Yes\n"); else printf("No\n"); return 0; };

Compilation message (stderr)

remittance.cpp: In function 'int main()':
remittance.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
   ~~~~~^~~~~~~~~
remittance.cpp:16: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...