# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
392674 | 2021-04-21T13:21:13 Z | Ruxandra985 | Teams (CEOI11_tea) | C++14 | 20 ms | 424 KB |
#include <bits/stdc++.h> #define DIMN 5010 using namespace std; struct idk{ int ech , ok , sz , fth; } dp[DIMN]; pair <int , int> v[DIMN]; int main() { FILE *fin = stdin; FILE *fout = stdout; int n , i , j , now; fscanf (fin,"%d",&n); for (i = 1 ; i <= n ; i++){ fscanf (fin,"%d",&v[i].first); v[i].second = i; } sort (v + 1 , v + n + 1); dp[0].ok = 1; for (i = 1 ; i <= n ; i++){ for (j = i - v[i].first ; j >= 0 ; j--){ if (!dp[j].ok) continue; if (dp[j].ech + 1 > dp[i].ech){ dp[i].ech = dp[j].ech + 1; dp[i].ok = 1; dp[i].sz = max(i - j , dp[j].sz); dp[i].fth = j; } else if (dp[j].ech + 1 == dp[i].ech && max(i - j , dp[j].sz) < dp[i].sz){ dp[i].ech = dp[j].ech + 1; dp[i].ok = 1; dp[i].sz = max(i - j , dp[j].sz); dp[i].fth = j; } } } fprintf (fout,"%d\n" , dp[n].ech); now = n; while (now){ fprintf (fout,"%d ", now - dp[now].fth); for (i = now ; i > dp[now].fth ; i--) fprintf (fout,"%d ",v[i].second); fprintf (fout,"\n"); now = dp[now].fth; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 332 KB | Output is correct |
2 | Correct | 20 ms | 408 KB | Output is correct |
3 | Correct | 15 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 332 KB | Output is correct |
2 | Correct | 11 ms | 424 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3 ms | 336 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3 ms | 332 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3 ms | 332 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4 ms | 332 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3 ms | 332 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |