# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
213218 | dolphingarlic | Coins (BOI06_coins) | C++14 | 138 ms | 10104 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 <cstdio>
int a[500001], b[500001];
int main() {
int n, k, sm = 0, cnt = 0;
scanf("%d %d", &n, &k);
for (int i = 0; i < n; i++) scanf("%d %d", a + i, b + i);
a[n] = k;
for (int i = 0; i < n; i++) {
if (b[i]) continue;
if (sm + a[i] < a[i + 1]) sm += a[i], cnt++;
}
printf("%d\n%d\n", cnt, k - (sm ? sm : 1));
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |