답안 #76790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
76790 2018-09-18T05:58:24 Z kdh9949 Teams (CEOI11_tea) C++17
0 / 100
340 ms 36704 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1000005;

int n, a[N], p[N];
vector<vector<int>> r;

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", a + i);
    iota(p, p + n, 0);
    sort(p, p + n, [](int x, int y){ return a[x] > a[y]; });
    for(int i = 0, j; i < n; i += j){
        j = a[p[i]];
        if(i + j > n){
            for(int k = i, c = r.size() - 1; k < n; k++, c--){
                if(c < 0) c = r.size() - 1;
                r[c].push_back(p[k] + 1);
            }
            break;
        }
        r.push_back(vector<int>());
        for(int k = i; k < i + j; k++) r.back().push_back(p[k] + 1);
    }
    printf("%d\n", r.size());
    for(const vector<int> &i : r){
        printf("%d ", i.size());
        for(int j : i) printf("%d ", j);
        puts("");
    }
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:26:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<std::vector<int> >::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n", r.size());
                    ~~~~~~~~^
tea.cpp:28:31: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
         printf("%d ", i.size());
                       ~~~~~~~~^
tea.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
tea.cpp:11:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 0; i < n; i++) scanf("%d", a + i);
                                ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Incorrect 2 ms 592 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 592 KB Output is correct
2 Incorrect 2 ms 592 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 712 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 2692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 3428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 226 ms 19772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 335 ms 29948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 340 ms 36704 KB Output isn't correct
2 Halted 0 ms 0 KB -