# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
492466 | 2021-12-07T13:07:30 Z | vulpes | Coins (BOI06_coins) | C++17 | 93 ms | 9964 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]; } } cout << x << endl << k - s << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 208 KB | Output is correct |
5 | Correct | 0 ms | 208 KB | Output is correct |
6 | Correct | 0 ms | 288 KB | Output is correct |
7 | Correct | 77 ms | 9948 KB | Output is correct |
8 | Incorrect | 81 ms | 9964 KB | Output isn't correct |
9 | Correct | 93 ms | 9956 KB | Output is correct |
10 | Correct | 84 ms | 9696 KB | Output is correct |