# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
57496 |
2018-07-15T07:40:26 Z |
노영훈(#1670) |
Teams (CEOI11_tea) |
C++11 |
|
381 ms |
36044 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, mx;
} S[MX];
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;
});
vector<int> Q;
Q.push_back(0);
for(int i=1; i<=n; i++){
S[i].cut=-1, S[i].cnt=-1, S[i].mx=inf;
auto it=upper_bound(Q.begin(), Q.end(), i-S[i].a);
if(it==Q.begin()) continue;
it--; int j=*it;
// cout<<i<<' '<<j<<'\n';
S[i].cnt=S[j].cnt+1, S[i].mx=max(S[j].mx, i-j), S[i].cut=j;
int k=Q.back();
// if(S[k].cnt<S[i].cnt || (S[k].cnt==S[i].cnt && S[k].mx>S[i].mx)){
if(S[k].cnt<=S[i].cnt){
Q.push_back(i);
}
// for(int x:Q) cout<<x<<' ';
// cout<<'\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 |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
408 KB |
Output is correct |
3 |
Incorrect |
3 ms |
572 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
756 KB |
Output is correct |
2 |
Incorrect |
4 ms |
892 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
3796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
39 ms |
4608 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
254 ms |
27084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
361 ms |
35788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
381 ms |
36044 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |