Submission #1075140

# Submission time Handle Problem Language Result Execution time Memory
1075140 2024-08-25T18:58:41 Z inkvizytor Job Scheduling (CEOI12_jobs) C++17
20 / 100
104 ms 21436 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, d, m;
    cin >> n >> d >> m;
    vector<int> v (n+1, 0), sp (n+1, 0);
    vector<vector<int>> c (n+1);
    for (int i = 1; i < m+1; i++) {
        int x;
        cin >> x;
        v[x]++;
        c[x].push_back(i);
    }
    vector<int> s;
    for (auto i : c) {
        for (int x : i) {
            s.push_back(x);
        }
    }
    int sum = 0;
    for (int i = 1; i < n+1; i++) {
        sp[i] = sp[i-1]+v[i];
    }
    int p = 0, j = 1<<20;
    while (j > 0) {
        int k = p+j;
        int wyk = 0;
        bool b = 1;
        for (int i = 1; i < n+1; i++) {
            wyk = min(wyk+k, sp[i]);
            if (i > d+1 && wyk < sp[i-d-1]) {
                b = 0;
                break;
            }
        }
        if (!b) {
            p += j;
        }
        j /= 2;
    }
    cout << p+1 << '\n';
    int k = p+1, nr = 0;
    int wyk = 0;
    for (int i = 1; i < n+1; i++) {
        wyk = min(wyk+k, sp[i]);
        while (nr < wyk) {
            cout << s[nr] << ' ';
            nr++;
        }
        cout << "0\n";
    }
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:23:9: warning: unused variable 'sum' [-Wunused-variable]
   23 |     int sum = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 2512 KB Output isn't correct
2 Incorrect 11 ms 2512 KB Output isn't correct
3 Incorrect 10 ms 2516 KB Output isn't correct
4 Incorrect 11 ms 2516 KB Output isn't correct
5 Incorrect 10 ms 2516 KB Output isn't correct
6 Incorrect 10 ms 2516 KB Output isn't correct
7 Incorrect 11 ms 2516 KB Output isn't correct
8 Incorrect 11 ms 2512 KB Output isn't correct
9 Incorrect 15 ms 5624 KB Output isn't correct
10 Incorrect 15 ms 5604 KB Output isn't correct
11 Correct 11 ms 2512 KB Output is correct
12 Correct 23 ms 4512 KB Output is correct
13 Incorrect 34 ms 7124 KB Output isn't correct
14 Correct 52 ms 9668 KB Output is correct
15 Incorrect 51 ms 10944 KB Output isn't correct
16 Correct 76 ms 14200 KB Output is correct
17 Incorrect 88 ms 16828 KB Output isn't correct
18 Incorrect 81 ms 16864 KB Output isn't correct
19 Incorrect 104 ms 21436 KB Output isn't correct
20 Incorrect 88 ms 16828 KB Output isn't correct