# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154542 | 2019-09-22T15:50:56 Z | arnold518 | MP3 Player (CEOI10_mp3player) | C++14 | 1000 ms | 3316 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=2; 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 | Correct | 3 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 404 KB | Output is correct |
2 | Correct | 28 ms | 352 KB | Output is correct |
3 | Correct | 27 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 305 ms | 460 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 988 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 1100 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 1188 KB | Output is correct |
2 | Correct | 17 ms | 1184 KB | Output is correct |
3 | Correct | 22 ms | 1488 KB | Output is correct |
4 | Incorrect | 17 ms | 1144 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 1696 KB | Output is correct |
2 | Correct | 27 ms | 1796 KB | Output is correct |
3 | Incorrect | 25 ms | 1616 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 3316 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 2932 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |