답안 #329101

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
329101 2020-11-19T05:32:50 Z thecodingwizard Teams (CEOI11_tea) C++11
0 / 100
319 ms 15312 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define ii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define F0R(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define inf 1000000010

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int n; cin >> n;
    vector<ii> A;
    F0R(i, n) {
        int x; cin >> x; A.pb(mp(x,i+1));
    }
    sort(all(A));

    int teams = 1;
    vector<int> breakpoints;
    for (int i = 0; i < n-A.back().f; i++) {
        int curSz = 1;
        while (curSz < A[i].f && i+1 < n-A.back().f) {
            curSz++;
            i++;
        }
        if (curSz >= A[i].f) {
            teams++;
            breakpoints.pb(i);
        }
    }

    breakpoints.pb(n-1);

    for (int i = breakpoints.size()-2; ~i; i--) {
        int j;
        for (j = breakpoints[i]; breakpoints[i+1]-j > A[breakpoints[i+1]].f; j++) {
            if (j-(i==0?0:breakpoints[i-1])+1 >= A[j].f) continue;
            --j;
            break;
        }
        breakpoints[i] = j;
    }

    cout << teams << endl;
    int curIdx = 0;
    for (int x : breakpoints) {
        cout << x - curIdx + 1;
        for (; curIdx <= x; curIdx++) cout << " " << A[curIdx].s;
        cout << endl;
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 492 KB Output is correct
2 Incorrect 2 ms 492 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 1640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 1768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 229 ms 11680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 301 ms 15184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 319 ms 15312 KB Output isn't correct
2 Halted 0 ms 0 KB -