Submission #146254

# Submission time Handle Problem Language Result Execution time Memory
146254 2019-08-23T06:24:19 Z dolphingarlic Job Scheduling (CEOI12_jobs) C++14
55 / 100
338 ms 13836 KB
#include <bits/stdc++.h>
#pragma GCC Optimize("O3")
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;

pair<int, int> a[1000001];

bool check(int machines, int jobs, int delay) {
    FOR(i, 0, jobs) {
        if (i / machines + 1 - a[i].first > delay) return false;
    }
    return true;
}

int main() {
    iostream::sync_with_stdio(false);
    cin.tie(0);
    int n, d, m;
    cin >> n >> d >> m;
    FOR(i, 0, m) {
        cin >> a[i].first;
        a[i].second = i + 1;
    }
    sort(a, a + m);

    int l = 1, r = m;
    while (l != r) {
        int mid = (l + r) / 2;
        if (check(mid, m, d)) r = mid;
        else l = mid + 1;
    }

    cout << l << '\n';
    FOR(i, 0, n) {
        FOR(j, i * l, min(i * l + l, m)) cout << a[j].second << ' ';
        cout << "0\n";
    }
    return 0;
}

Compilation message

jobs.cpp:2:0: warning: ignoring #pragma GCC Optimize [-Wunknown-pragmas]
 #pragma GCC Optimize("O3")
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1784 KB Output isn't correct
2 Incorrect 27 ms 1784 KB Output isn't correct
3 Incorrect 27 ms 1784 KB Output isn't correct
4 Incorrect 28 ms 1788 KB Output isn't correct
5 Incorrect 27 ms 1784 KB Output isn't correct
6 Incorrect 27 ms 1784 KB Output isn't correct
7 Incorrect 27 ms 1912 KB Output isn't correct
8 Incorrect 27 ms 1784 KB Output isn't correct
9 Correct 38 ms 2040 KB Output is correct
10 Correct 37 ms 1912 KB Output is correct
11 Correct 36 ms 1784 KB Output is correct
12 Correct 72 ms 3192 KB Output is correct
13 Correct 109 ms 4780 KB Output is correct
14 Correct 150 ms 6236 KB Output is correct
15 Incorrect 180 ms 7644 KB Output isn't correct
16 Correct 221 ms 9208 KB Output is correct
17 Correct 261 ms 10744 KB Output is correct
18 Correct 297 ms 12100 KB Output is correct
19 Correct 338 ms 13836 KB Output is correct
20 Correct 260 ms 10744 KB Output is correct