# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
135444 | 2019-07-24T05:46:40 Z | 송준혁(#3252) | MP3 Player (CEOI10_mp3player) | C++14 | 1000 ms | 892 KB |
#include <bits/stdc++.h> #define INF 1234567890 using namespace std; typedef long long LL; typedef pair<int, int> pii; int N, V, L; int ans, V1; int D[5050], B[5050]; char ch[101010]; int d[101010]; int main(){ scanf("%d %d %d", &N, &V, &L); int x, y; for (int i=0; i<N; i++){ scanf(" %c %d", &ch[i], &y); d[i] = y - x, x = y; } D[L] = INF; for (int i=N-1; i>0; i--){ for (int j=0; j<=V; j++){ if (d[i] < D[j]) { if (ch[i] == '+' && j>0) B[j-1] = max(D[j], B[j-1]); if (ch[i] == '+' && j==V) B[V] = max(D[j], B[V]); if (ch[i] == '-' && j<V) B[j+1] = max(D[j], B[j+1]); if (ch[i] == '-' && j==0) B[0] = max(D[j], B[0]); } B[j] = max(B[j], min(d[i], D[j])); } for (int j=0; j<=V; j++) D[j] = B[j], B[j] = 0; } for (int i=V; i>=0; i--) if (ans < D[i]) ans = D[i], V1 = i; if (ans == INF) puts("infinity"); else printf("%d %d\n", ans-1, V1); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 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 | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 404 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 436 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 568 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 632 KB | Output is correct |
2 | Incorrect | 12 ms | 888 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 301 ms | 892 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1076 ms | 892 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |