# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
492466 | vulpes | Coins (BOI06_coins) | C++17 | 93 ms | 9964 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];
}
}
cout << x << endl << k - s << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |