# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
274680 | 2020-08-19T14:02:46 Z | arnold518 | Teams (CEOI11_tea) | C++14 | 2500 ms | 18040 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 = 1e6; const int INF = 987654321; int N, A[MAXN+10]; pii B[MAXN+10]; pii dp[MAXN+10]; int memo[MAXN+10]; int main() { scanf("%d", &N); for(int i=1; i<=N; i++) scanf("%d", &A[i]), B[i]={A[i], i}; sort(B+1, B+N+1); for(int i=1; i<=N; i++) { dp[i]={-INF, INF}; memo[i]=-1; for(int j=0; i-j>=B[i].first; j++) { pii t=dp[j]; t.first++; t.second=max(t.second, i-j); if(t.first>dp[i].first) dp[i]=t, memo[i]=j; else if(t.first==dp[i].first && t.second<dp[i].second) dp[i]=t, memo[i]=j; } } printf("%d\n", dp[N].first); int now=N; while(now) { printf("%d ", now-memo[now]); for(int i=now; i>memo[now]; i--) printf("%d ", B[i].second); printf("\n"); now=memo[now]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 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 | 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 | 14 ms | 512 KB | Output is correct |
2 | Correct | 21 ms | 512 KB | Output is correct |
3 | Correct | 29 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 512 KB | Output is correct |
2 | Correct | 16 ms | 544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2564 ms | 2400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2568 ms | 2648 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2555 ms | 10248 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2578 ms | 13980 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2586 ms | 18040 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |