# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
572663 |
2022-06-05T00:06:12 Z |
byunjaewoo |
Coins (BOI06_coins) |
C++17 |
|
90 ms |
10452 KB |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int Nmax=500010;
int N;
ll K, cnt, sum, C[Nmax];
bool D[Nmax];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>N>>K;
for(int i=1; i<=N; i++) cin>>C[i]>>D[i];
C[N+1]=LLONG_MAX;
for(int i=1; i<=N; i++) if(!D[i]) {
if(sum+C[i]>=C[i+1] || sum+C[i]>=K) continue;
sum+=C[i]; cnt++;
}
cout<<cnt<<"\n"<<K-sum;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
324 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
332 KB |
Output is correct |
7 |
Correct |
89 ms |
10380 KB |
Output is correct |
8 |
Incorrect |
85 ms |
10452 KB |
Output isn't correct |
9 |
Correct |
90 ms |
10444 KB |
Output is correct |
10 |
Correct |
85 ms |
10252 KB |
Output is correct |