Submission #152318

#TimeUsernameProblemLanguageResultExecution timeMemory
152318ivandasfsRemittance (JOI19_remittance)C++14
100 / 100
978 ms28676 KiB
#include <iostream> #include <cstdio> using namespace std; pair<int, int> p[1000005]; int main() { int n; scanf("%d", &n); for (int i=0 ; i<n ; i++) { scanf("%d %d", &p[i].first, &p[i].second); } int off=0; for (int j=0 ; j<50*n ; j++) { if (j==25) off++; int i = j%n; int k = (i+1)%n; if (p[i].first>p[i].second) { int br = (p[i].first - p[i].second + off) / 2; if (p[i].first < br*2) continue; p[i].first -= br*2; p[k].first += br; } } for (int i=0 ; i<n ; i++) { if (p[i].first != p[i].second) { printf("No\n"); return 0; } } printf("Yes\n"); return 0; }

Compilation message (stderr)

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