답안 #497294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
497294 2021-12-23T00:36:47 Z dutinmeow Job Scheduling (CEOI12_jobs) C++17
15 / 100
377 ms 23980 KB
#include <bits/stdc++.h>
using namespace std;

using pii = pair<long long, long long>;

long long N, D, M;
pii A[1000005];

bool check(long long m) {
    for (int i = 1, j = 0; i <= N && j < M; i++) 
        for (int k = 0; k < m && j < M && A[j].first <= i; k++, j++) 
            if (i - A[j].first > D) 
                return 0;
    return 1;
}

int main() {
    cin >> N >> D >> M;
    for (int i = 0; i < M; i++) {
        int a; cin >> a;
        A[i] = {a, i + 1};
    }
    sort(A, A + M);

    long long l = 0, r = M;
    while (l < r) {
        long long m = (l + r) / 2;
        if (check(m))
            r = m;
        else 
            l = m + 1;
    }

    cout << l << '\n';
    for (int i = 1, j = 0; i <= N && j < M; i++) {
        for (int k = 0; k < l && j < M && A[j].first <= i; k++, j++) 
            cout << A[j].second << ' ';
        cout << 0 << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 2624 KB Unexpected end of file - int32 expected
2 Incorrect 27 ms 2700 KB Unexpected end of file - int32 expected
3 Incorrect 27 ms 2688 KB Unexpected end of file - int32 expected
4 Incorrect 36 ms 2612 KB Unexpected end of file - int32 expected
5 Incorrect 37 ms 2688 KB Unexpected end of file - int32 expected
6 Incorrect 27 ms 2692 KB Unexpected end of file - int32 expected
7 Incorrect 28 ms 2712 KB Unexpected end of file - int32 expected
8 Incorrect 30 ms 2612 KB Unexpected end of file - int32 expected
9 Incorrect 33 ms 2600 KB Unexpected end of file - int32 expected
10 Incorrect 33 ms 2612 KB Unexpected end of file - int32 expected
11 Incorrect 48 ms 2852 KB Unexpected end of file - int32 expected
12 Correct 77 ms 5440 KB Output is correct
13 Incorrect 113 ms 8024 KB Unexpected end of file - int32 expected
14 Correct 167 ms 11056 KB Output is correct
15 Correct 192 ms 13340 KB Output is correct
16 Incorrect 260 ms 16600 KB Unexpected end of file - int32 expected
17 Incorrect 301 ms 19304 KB Unexpected end of file - int32 expected
18 Incorrect 314 ms 21312 KB Unexpected end of file - int32 expected
19 Incorrect 377 ms 23980 KB Unexpected end of file - int32 expected
20 Incorrect 309 ms 19404 KB Unexpected end of file - int32 expected