Submission #729948

#TimeUsernameProblemLanguageResultExecution timeMemory
729948thimote75Coins (BOI06_coins)C++14
90 / 100
302 ms10088 KiB
#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 timeMemoryGrader output
Fetching results...