| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 41576 | cheater2k | Gift (IZhO18_nicegift) | C++14 | 156 ms | 30652 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, k;
long long a[N];
long long sum;
vector < vector <int> > vres;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i], sum += a[i];
    }
    assert(sum <= 1e5);
    if (sum % k != 0) return printf("-1\n"), 0;
    priority_queue < pair<int,int> > pq;
    for (int i = 1; i <= n; ++i) pq.push(make_pair(a[i], i));
    while(!pq.empty()) {
        int taken = 0;
        vector<int> cur;
        while(!pq.empty() && taken < k) {
            int pos = pq.top().second; pq.pop();
            cur.push_back(pos);
            --a[pos];
            ++taken;
        }
        if (taken != k) return printf("-1\n"), 0;
        for (int pos : cur) {
            if (a[pos]) {
                pq.push(make_pair(a[pos], pos));
            }
        }
        vres.push_back(cur);
    }
    printf("%d\n", vres.size());
    for (auto &v : vres) {
        printf("1 "); // X
        for (int &pos : v) printf("%d ", pos); printf("\n");
    }
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
