# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544441 | rainboy | Coins (BOI06_coins) | C11 | 105 ms | 9888 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 <stdio.h>
#define N 500000
int main() {
static int cc[N], dd[N];
int n, k, i, cnt, x;
scanf("%d%d", &n, &k);
for (i = 0; i < n; i++)
scanf("%d%d", &cc[i], &dd[i]);
cnt = 0, x = 0;
for (i = 0; i < n; i++)
if (!dd[i] && x + cc[i] < (i + 1 == n ? k : cc[i + 1]))
cnt++, x += cc[i];
printf("%d\n", cnt);
printf("%d\n", k - (cnt == 0 ? 1 : x));
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |