# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
492470 | vulpes | Coins (BOI06_coins) | C++17 | 90 ms | 4584 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |