Submission #199456

#TimeUsernameProblemLanguageResultExecution timeMemory
199456TadijaSebezCoins (BOI06_coins)C++11
100 / 100
174 ms10104 KiB
#include <bits/stdc++.h> using namespace std; const int N=500050; int c[N],d[N]; int main() { int n,k; scanf("%i %i",&n,&k); int sum=0,cnt=0; for(int i=1;i<=n;i++) { scanf("%i %i",&c[i],&d[i]); } c[n+1]=k; for(int i=1;i<=n;i++) { if(d[i]==0) { if(c[i]+sum<c[i+1]) { sum+=c[i]; cnt++; } } } if(cnt==0) sum=1; printf("%i\n%i\n",cnt,k-sum); return 0; }

Compilation message (stderr)

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