# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137598 | khsoo01 | Coins (BOI06_coins) | C++11 | 120 ms | 4256 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;
const int N = 500005;
int n, m, a[N], b[N], ans1, ans2;
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++) {
scanf("%d%d",&a[i],&b[i]);
}
a[n+1] = m;
for(int i=1;i<=n;i++) {
if(b[i]) continue;
if(ans2 + a[i] < a[i+1]) {
ans1++;
ans2 += a[i];
}
}
printf("%d\n%d\n", ans1, m-max(1, ans2));
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |