# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
902707 |
2024-01-11T00:57:04 Z |
Darren0724 |
Teams (CEOI11_tea) |
C++17 |
|
212 ms |
55764 KB |
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define all(x) x.begin(), x.end()
const int N=200005;
int32_t main() {
LCBorz;
int n;cin>>n;
vector<int> a[n+1];
vector<int> v(n+1);
for(int i=1;i<=n;i++){
cin>>v[i];
a[v[i]].push_back(i);
}
sort(all(v));
vector<int> dp(n+1);
vector<int> mx(n+1);
for(int i=1;i<=n;i++){
if(i>=v[i])dp[i]=dp[mx[i-v[i]]]+1;
mx[i]=(dp[mx[i-1]]>=dp[i]?mx[i-1]:i);
}
vector<vector<int>> ans;
int p=n;
while(p>0){
ans.push_back(vector<int>());
int t=mx[p-v[p]];
while(p>t){
ans.back().push_back(a[v[p]].back());
a[v[p]].pop_back();
p--;
}
}
cout<<dp[n]<<endl;
for(auto &i:ans){
cout<<i.size()<<' ';
for(int j:i){
cout<<j<<' ';
}
cout<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Incorrect |
0 ms |
360 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
4968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
136 ms |
40156 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
52348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
212 ms |
55764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |