# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
573756 | pokmui9909 | Coins (BOI06_coins) | C++17 | 103 ms | 13916 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;
using ll = long long;
ll N, K;
ll C[500005], D[500005];
int main(){
cin.tie(0) -> sync_with_stdio(false);
cin >> N >> K;
for(ll i = 1; i <= N; i++){
cin >> C[i] >> D[i];
}
C[N + 1] = 1e18;
ll S = 0, P = 0;
for(ll i = 1; i <= N; i++){
if(D[i] == 0 && S + C[i] < K && S + C[i] < C[i + 1]){
S += C[i], P++;
}
}
if(S == 0) S = 1;
cout << P << '\n' << K - S;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |