# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154539 | 2019-09-22T15:45:49 Z | arnold518 | MP3 Player (CEOI10_mp3player) | C++14 | 1000 ms | 2140 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e5; int N, Vmax, V2, ans; pii A[MAXN+10]; bool decide(int X) { int i, j; vector<int> S; for(i=1; i<=N; i++) if(A[i].second-A[i-1].second<=X) S.push_back(A[i].first); for(i=Vmax; i>=0; i--) { int now=i; for(j=0; j<S.size(); j++) { now+=S[j]; if(now>Vmax) now=Vmax; if(now<0) now=0; } if(now==V2) { ans=i; return true; } } return false; } int main() { int i, j; scanf("%d%d%d", &N, &Vmax, &V2); for(i=1; i<=N; i++) { char a; int b; scanf("\n%c%d", &a, &b); if(a=='+') A[i]=pii(1, b); else A[i]=pii(-1, b); } ll lo=0, hi=2e9+10; while(lo+1<hi) { ll mid=lo+hi>>1; if(decide(mid)) lo=mid; else hi=mid; } if(lo>2e9+5) printf("infinity"); else { printf("%lld ", lo); decide(lo); printf("%d", ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 305 ms | 428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 748 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 784 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 836 KB | Output is correct |
2 | Correct | 17 ms | 1188 KB | Output is correct |
3 | Incorrect | 21 ms | 1456 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 1128 KB | Output is correct |
2 | Incorrect | 26 ms | 1696 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 2140 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1071 ms | 1780 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |