답안 #1000098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000098 2024-06-16T16:27:44 Z codexistent Job Scheduling (CEOI12_jobs) C++14
40 / 100
352 ms 14160 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define MAXN 100005
#define MAXM 1000000

int n, d, m, arr[MAXN], res = 0;
pair<int, int> req[MAXM];

int main(){
    cin >> n >> d >> m;
    FOR(i, 1, n) arr[i] = 0;
    FOR(i, 1, m){
        int x; cin >> x;
        arr[x]++;
        req[i - 1] = {x, i};
    }
    sort(req,  req + m - 1);

    multiset<int> s; 
    FOR(i, 1, 1 + d) s.insert(0);

    FOR(i, 1, n){
        res = max(res, *s.rbegin());
        s.erase(s.find(*s.rbegin()));
            s.insert(0);

        FOR(j, 1, arr[i]){
            int k = *s.begin();
            s.erase(s.begin());
            s.insert(k + 1);
        }
    }
    res = max(res, *s.rbegin());

    cout << res << endl;

    int k = -1;
    FOR(i, 1, n){
        int j = 1;
        while(j <= res && (k + 1 < m) && (req[k + 1].first <= i && i <= req[k + 1].first + d)){
            cout << req[k + 1].second << " ";
            j++, k++;
        }

        cout << "0" << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 3160 KB Output is correct
2 Correct 32 ms 3164 KB Output is correct
3 Correct 29 ms 3164 KB Output is correct
4 Correct 29 ms 3160 KB Output is correct
5 Correct 29 ms 3160 KB Output is correct
6 Correct 32 ms 3164 KB Output is correct
7 Correct 29 ms 3164 KB Output is correct
8 Correct 29 ms 3300 KB Output is correct
9 Incorrect 118 ms 3720 KB Output isn't correct
10 Incorrect 144 ms 3660 KB Output isn't correct
11 Incorrect 28 ms 3152 KB Output isn't correct
12 Incorrect 57 ms 3920 KB Output isn't correct
13 Incorrect 95 ms 6484 KB Output isn't correct
14 Incorrect 133 ms 7508 KB Output isn't correct
15 Incorrect 138 ms 8020 KB Output isn't correct
16 Incorrect 189 ms 10836 KB Output isn't correct
17 Incorrect 220 ms 11392 KB Output isn't correct
18 Incorrect 236 ms 12176 KB Output isn't correct
19 Incorrect 352 ms 14160 KB Output isn't correct
20 Incorrect 220 ms 11608 KB Output isn't correct