# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151394 | gs14004 | Coins (BOI06_coins) | C++17 | 119 ms | 4280 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>
#define sz(v) ((int)(v).size())
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
int main(){
int n, k; scanf("%d %d",&n,&k);
vector<pi> v(n + 1);
for(int i=0; i<n; i++) scanf("%d %d",&v[i].first,&v[i].second);
v[n].first = k;
int sum = 0, cnt = 0;
for(int i=0; i<n; i++){
if(!v[i].second && sum + v[i].first < v[i+1].first){
sum += v[i].first;
cnt++;
}
}
cout << cnt << endl << k - sum << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |