Submission #1000161

# Submission time Handle Problem Language Result Execution time Memory
1000161 2024-06-16T18:28:57 Z codexistent Job Scheduling (CEOI12_jobs) C++14
0 / 100
1 ms 348 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];
pair<int, int> req[MAXM];

int main(){
    ifstream cin("job.in");
    ofstream cout("job.out");

    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);
// 4762
    multiset<int> s; 
    FOR(i, 1, 1 + d) s.insert(0);

    int a = 1, b = m;
    while(a < b){
        int mid = (a + b) / 2;
        bool valid = true;

        int k = -1;
        FOR(i, 1, n){
            int j = 1;
            while(j <= mid && (k + 1 < m) && (req[k + 1].first <= i && i <= req[k + 1].first + d)){
                j++, k++;
            }
            //cout << k + 1 << " " << req[k + 1].first << " ~ " << i << endl;
        }
        if(k != m - 1) valid = false;

        //cout << " YOYO m " << a << " is " << valid << " and we see " << k << endl;

        if(valid){
            b = mid;
        }else{
            a = mid + 1;
        }

    }

    cout << a << endl;

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

        cout << "0" << endl;
    }
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4

2 0 8
2 2 2 2 1 2 2 2
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
2 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
3 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
4 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
5 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
6 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
7 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
8 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
9 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
10 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
11 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
12 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
14 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
15 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
16 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
17 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
18 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
19 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
20 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected