# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199456 | TadijaSebez | Coins (BOI06_coins) | C++11 | 174 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 <bits/stdc++.h>
using namespace std;
const int N=500050;
int c[N],d[N];
int main()
{
int n,k;
scanf("%i %i",&n,&k);
int sum=0,cnt=0;
for(int i=1;i<=n;i++)
{
scanf("%i %i",&c[i],&d[i]);
}
c[n+1]=k;
for(int i=1;i<=n;i++)
{
if(d[i]==0)
{
if(c[i]+sum<c[i+1])
{
sum+=c[i];
cnt++;
}
}
}
if(cnt==0) sum=1;
printf("%i\n%i\n",cnt,k-sum);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |