# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199456 | 2020-02-01T12:54:33 Z | TadijaSebez | Coins (BOI06_coins) | C++11 | 174 ms | 10104 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 130 ms | 10104 KB | Output is correct |
8 | Correct | 127 ms | 9980 KB | Output is correct |
9 | Correct | 174 ms | 9976 KB | Output is correct |
10 | Correct | 141 ms | 9848 KB | Output is correct |