# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
137583 | 2019-07-28T06:57:01 Z | 이온조(#3279) | Coins (BOI06_coins) | C++14 | 123 ms | 6268 KB |
#include <bits/stdc++.h> using namespace std; const int L = 500000000; int N, K, A[500009]; long long C[500009]; int main() { scanf("%d%d",&N,&K); for(int i=1; i<=N; i++) { scanf("%lld%d",&C[i],&A[i]); A[i] = 1 - A[i]; } C[N+1] = K; long long s = 0; int ans = 0, la = K-1; for(int i=1; i<=N; i++) { if(A[i] && C[i] + s < C[i+1]) { ++ans; la = K - (C[i] + s); s += C[i]; } } printf("%d\n%d", ans, la); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 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 | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 106 ms | 6152 KB | Output is correct |
8 | Correct | 105 ms | 6136 KB | Output is correct |
9 | Correct | 120 ms | 6268 KB | Output is correct |
10 | Correct | 123 ms | 6136 KB | Output is correct |