Submission #136084

#TimeUsernameProblemLanguageResultExecution timeMemory
136084dnassRemittance (JOI19_remittance)C++14
0 / 100
2 ms380 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int lld; lld n; lld a[21]; int main(){ scanf("%lld", &n); for(lld i=0;i<n;i++){ lld tmpa, tmpb; scanf("%lld %lld", &tmpa, &tmpb); a[i] = tmpa-tmpb; } lld sum = 0; lld pow_two = 1; for(lld i=0;i<n;i++){ sum += pow_two*a[i]; pow_two *= 2; } if(sum%(pow_two-1)!=0){ printf("No\n"); return 0; } sum /= (pow_two-1); for(lld i=n-1;i>=0;i--){ sum *= 2; sum -= a[i]; if(sum<0){ 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("%lld", &n);
  ~~~~~^~~~~~~~~~~~
remittance.cpp:12:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   lld tmpa, tmpb; scanf("%lld %lld", &tmpa, &tmpb);
                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...