Submission #57571

# Submission time Handle Problem Language Result Execution time Memory
57571 2018-07-15T09:16:47 Z 노영훈(#1670) Teams (CEOI11_tea) C++11
0 / 100
2500 ms 37536 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;
    });

    // deque<node> Q;

    for(int i=1; i<=n; i++){
        S[i].cut=-1, S[i].cnt=-1, S[i].mx=inf;
        for(int j=i-S[i].a; j>=0; j--){
            if(S[j].cut<0) continue;
            if(S[i].cnt<S[j].cnt+1)
                S[i].cnt=S[j].cnt+1, S[i].cut=j;
        }
    }

    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 492 KB Output is correct
3 Incorrect 3 ms 492 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 736 KB Output is correct
2 Incorrect 12 ms 816 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2431 ms 3536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2541 ms 3536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2561 ms 20076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2561 ms 30708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2519 ms 37536 KB Time limit exceeded
2 Halted 0 ms 0 KB -