Submission #264061

# Submission time Handle Problem Language Result Execution time Memory
264061 2020-08-14T04:56:26 Z 반딧불(#5094) Teams (CEOI11_tea) C++17
0 / 100
400 ms 23248 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
vector<pair<int, int> > v;
int teamCnt;

vector<int> vec;

bool able(int sz){
    if(sz * teamCnt < n) return false;
    return true;
}

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        int x;
        scanf("%d", &x);
        v.push_back({x, i});
    }

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    for(int i=0; i<n; ){
        if(i + v[i].first <= n){
            teamCnt++;
            i = i + v[i].first;
        }
        else break;
    }

    printf("%d\n", teamCnt);

    int l = v[0].first, r = n, ans = v[0].first;
    while(l <= r){
        int m = (l+r)>>1;
        if(able(m)){
            ans = m;
            r = m-1;
        }
        else l = m+1;
    }

    int j = 0;
    for(int i=1; i<=teamCnt; i++){
        vec.clear();
        for(; j<i*ans && j<n-(teamCnt-i); j++){
            vec.push_back(v[j].second);
        }

        printf("%d ", (int)vec.size());
        for(auto &x: vec) printf("%d ", x);
        puts("");
    }
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
tea.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1644 KB Output is correct
2 Incorrect 25 ms 1528 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 310 ms 11472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 385 ms 16004 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 400 ms 19208 KB Output is correct
2 Correct 305 ms 23248 KB Output is correct
3 Incorrect 375 ms 15184 KB Output isn't correct
4 Halted 0 ms 0 KB -