# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
729950 |
2023-04-24T22:47:32 Z |
thimote75 |
Coins (BOI06_coins) |
C++14 |
|
259 ms |
4208 KB |
#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 << (last == 0 ? K - 1 : (K - last)) << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
255 ms |
4204 KB |
Output is correct |
8 |
Correct |
259 ms |
4196 KB |
Output is correct |
9 |
Correct |
247 ms |
4208 KB |
Output is correct |
10 |
Correct |
252 ms |
4196 KB |
Output is correct |