# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137596 | 2019-07-28T07:13:50 Z | 김현수(#3360) | Coins (BOI06_coins) | C++14 | 120 ms | 6540 KB |
#include<bits/stdc++.h> using namespace std; const int N = 500005; int n, m, a[N], b[N], ans1, ans2; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) { scanf("%d%d",&a[i],&b[i]); } a[n+1] = m; for(int i=1;i<=n;i++) { if(b[i]) continue; if(ans2 + a[i] < a[i+1]) { ans1++; ans2 += a[i]; } } printf("%d\n%d\n", ans1, m-ans2); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 108 ms | 6368 KB | Output is correct |
8 | Incorrect | 106 ms | 6364 KB | Output isn't correct |
9 | Correct | 120 ms | 6540 KB | Output is correct |
10 | Correct | 118 ms | 6244 KB | Output is correct |