# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137597 | 2019-07-28T07:14:59 Z | 김현수(#3360) | Coins (BOI06_coins) | C++14 | 120 ms | 4256 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-max(1, ans2)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 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 | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 107 ms | 4156 KB | Output is correct |
8 | Correct | 109 ms | 4172 KB | Output is correct |
9 | Correct | 120 ms | 4256 KB | Output is correct |
10 | Correct | 119 ms | 4208 KB | Output is correct |