# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
264563 | 2020-08-14T07:42:07 Z | 반딧불(#5094) | Teams (CEOI11_tea) | C++17 | 2500 ms | 61012 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; pair<int, int> arr[10002]; int DP[10002], DP2[10002]; int track[10002]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++){ int x; scanf("%d", &x); arr[i] = {x, i}; } sort(arr+1, arr+n+1); DP2[0] = -1000000000; for(int i=1; i<=n; i++){ DP[i] = -1e9; for(int j=0; j<=i-arr[i].first; j++){ if(DP[i] < DP[j]+1 || (DP[i] == DP[j]+1 && DP2[i] > max(DP2[j], i-j))){ DP[i] = DP[j]+1, DP2[i] = max(DP2[j], i-j); track[i] = j; } } } printf("%d\n", DP[n]); while(n){ printf("%d ", n - track[n]); for(int i=track[n]+1; i<=n; i++) printf("%d ", arr[i].second); puts(""); n = track[n]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 384 KB | Output is correct |
2 | Correct | 23 ms | 512 KB | Output is correct |
3 | Correct | 30 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 416 KB | Output is correct |
2 | Correct | 16 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2 ms | 384 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2568 ms | 61012 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2 ms | 384 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3 ms | 384 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |