# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
57558 |
2018-07-15T08:50:55 Z |
노영훈(#1670) |
Teams (CEOI11_tea) |
C++11 |
|
398 ms |
31440 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=1000010, inf=2e9;
int n;
struct stu {
int a, idx, cut, cnt;
} S[MX];
vector<int> V;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i=1; i<=n; i++){
cin>>S[i].a; S[i].idx=i;
}
sort(S+1, S+n+1, [](stu &a, stu &b){
return a.a<b.a;
});
V.push_back(0);
for(int i=1; i<=n; i++){
S[i].cut=-1, S[i].cnt=-1;
auto it1=upper_bound(V.begin(), V.end(), i-S[i].a);
if(it1==V.begin()) continue;
it1--; int j=*it1;
S[i].cnt=S[j].cnt+1; S[i].cut=j;
if(S[V.back()].cnt<=S[i].cnt) V.push_back(i);
}
// for(int i=1; i<=n; i++)
// cout<<i<<' '<<S[i].a<<' '<<S[i].cut<<' '<<S[i].cnt<<'\n';
vector<vector<int>> ans;
int now=n;
while(now>0){
vector<int> put;
for(int i=now; i>S[now].cut; i--)
put.push_back(S[i].idx);
ans.push_back(put);
now=S[now].cut;
}
cout<<ans.size()<<'\n';
for(auto &V:ans){
cout<<V.size()<<' ';
for(int x:V) cout<<x<<' ';
cout<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
828 KB |
Output is correct |
2 |
Incorrect |
4 ms |
868 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
2968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
3336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
244 ms |
23380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
398 ms |
31132 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
394 ms |
31440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |