# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151393 | 2019-09-02T15:49:47 Z | gs14004 | Coins (BOI06_coins) | C++17 | 121 ms | 10104 KB |
#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 + 1; 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 107 ms | 10036 KB | Output is correct |
8 | Incorrect | 108 ms | 10104 KB | Output isn't correct |
9 | Correct | 121 ms | 10064 KB | Output is correct |
10 | Correct | 120 ms | 9796 KB | Output is correct |