답안 #132564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132564 2019-07-19T07:27:01 Z Vardanyan Teams (CEOI11_tea) C++14
0 / 100
342 ms 27940 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1000*1000+5;
pair<int,int> a[N];
int main(){
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++){
        cin>>a[i].first;
        a[i].second = i;
    }
    sort(a+1,a+1+n);
    vector<vector<int> > ans;
    vector<int> now;
    int lim = n+1;
    for(int i = n;i>=1;i--){
        if(i>=lim){
            now.push_back(a[i].second);
            continue;
        }
        if(now.size()) ans.push_back(now);
        now.clear();
        lim = i-a[i].first+1;
        now.push_back(a[i].second);
    }
    if(now.size()) ans.push_back(now);
    cout<<ans.size()<<endl;
    for(int i = 0;i<ans.size();i++){
            cout<<ans[i].size()<<" ";
        for(int j = 0;j<ans[i].size();j++) cout<<ans[i][j]<<" ";
        cout<<endl;
    }

    return 0;
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i<ans.size();i++){
                   ~^~~~~~~~~~~
tea.cpp:31:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<ans[i].size();j++) cout<<ans[i][j]<<" ";
                       ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 388 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 2388 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 2524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 228 ms 18060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 321 ms 25320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 342 ms 27940 KB Output isn't correct
2 Halted 0 ms 0 KB -