# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
492470 | 2021-12-07T13:11:06 Z | vulpes | Coins (BOI06_coins) | C++17 | 90 ms | 4584 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; scanf("%d%d", &n, &k); vector<int> c(n + 1, k), d(n); for (int i = 0; i < n; i++) { scanf("%d%d", &c[i], &d[i]); } int s = 0, x = 0; for (int i = 0; i < n; i++) { if (!d[i] && c[i] + s < c[i + 1]) { x++; s += c[i]; } } s = max(s, 1); cout << x << endl << k - s << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 288 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 77 ms | 4576 KB | Output is correct |
8 | Correct | 85 ms | 4496 KB | Output is correct |
9 | Correct | 90 ms | 4584 KB | Output is correct |
10 | Correct | 80 ms | 4564 KB | Output is correct |