# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
274671 | 2020-08-19T13:57:43 Z | arnold518 | Teams (CEOI11_tea) | C++14 | 2500 ms | 23220 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}; for(int j=0; i-j>=A[i]; 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 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2568 ms | 2752 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2580 ms | 2796 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2566 ms | 13688 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2596 ms | 19344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2580 ms | 23220 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |