# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544441 | 2022-04-01T23:41:04 Z | rainboy | Coins (BOI06_coins) | C | 105 ms | 9888 KB |
#include <stdio.h> #define N 500000 int main() { static int cc[N], dd[N]; int n, k, i, cnt, x; scanf("%d%d", &n, &k); for (i = 0; i < n; i++) scanf("%d%d", &cc[i], &dd[i]); cnt = 0, x = 0; for (i = 0; i < n; i++) if (!dd[i] && x + cc[i] < (i + 1 == n ? k : cc[i + 1])) cnt++, x += cc[i]; printf("%d\n", cnt); printf("%d\n", k - (cnt == 0 ? 1 : x)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 94 ms | 9864 KB | Output is correct |
8 | Correct | 99 ms | 9844 KB | Output is correct |
9 | Correct | 105 ms | 9888 KB | Output is correct |
10 | Correct | 100 ms | 9724 KB | Output is correct |