# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
263988 | 2020-08-14T04:38:54 Z | 문홍윤(#5092) | Teams (CEOI11_tea) | C++17 | 451 ms | 79348 KB |
#include <bits/stdc++.h> #define F first #define S second #define eb emplace_back #define mp make_pair using namespace std; typedef pair<int, int> pii; const int inf=1e9; int n; pii arr[1000010], dp[1000010]; vector<int> vc[1000010]; pii ndp={-inf, -1}; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++){ scanf("%d", &arr[i].F); arr[i].S=i; } sort(arr+1, arr+n+1, greater<pii>()); for(int i=1; i<=n; i++){ for(auto j:vc[i+1])ndp=max(ndp, mp(dp[j].F+1, j)); dp[i]=ndp; if(i+arr[i].F<=n+1)vc[i+arr[i].F].eb(i-1); } printf("%d\n", dp[n].F); vector<vector<int> > ans; int nw=n; while(nw){ vector<int> tmp; for(int i=nw; i>dp[nw].S; i--)tmp.eb(arr[i].S); ans.eb(tmp); nw=dp[nw].S; } for(auto i:ans){ printf("%d ", i.size()); for(auto j:i)printf("%d ", j); puts(""); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 23808 KB | Integer -1000000000 violates the range [1, 1] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 23808 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 23808 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 24064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 24064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 46 ms | 27864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 50 ms | 28572 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 317 ms | 66936 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 434 ms | 79348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 451 ms | 68436 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |