# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
729948 | thimote75 | Coins (BOI06_coins) | C++14 | 302 ms | 10088 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;
#define di pair<int, int>
#define vd vector<di>
int main () {
int N, K;
cin >> N >> K;
vd res(N + 1);
for (int i = 0; i < N; i ++) {
int x, v;
cin >> x >> v;
res[i] = { x, 1 - v };
}
res[N] = { K, 0 };
int last = 0;
int mval = 0;
for (int i = 0; i < N; i ++) {
if (res[i].second == 0) continue ;
int dx = res[i + 1].first - res[i].first;
if (last >= dx) continue ;
last += res[i].first;
mval += 1;
}
cout << mval << endl;
cout << (K - last) << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |