Submission #857013

# Submission time Handle Problem Language Result Execution time Memory
857013 2023-10-05T08:22:09 Z AminMDNZ Job Scheduling (CEOI12_jobs) C++14
0 / 100
367 ms 20292 KB
#include<bits/stdc++.h>
using namespace std;
vector<pair<int, int>> arr;
int n, m , d;
vector<vector<int>> day;
bool f(int mm){
    int del = 0;
    day.clear();
    day.resize(n+1);
    queue<int> mac;
    for(int i=0;i<mm;i++) mac.push(1);
    for(int i=0;i<m;i++){
        int r = mac.front();
        del = max(r - arr[i].first, del);
        if(del > d) return false;
        day[r].push_back(arr[i].second);
        mac.pop();
        mac.push(r+1);
    }
    return true;
}
 
int main(){
    cin>>n>>d>>m;
    arr.resize(m);
    for(int i=0;i<m;i++){
        arr[i].second = i;
        cin>>arr[i].first;
    }
    sort(arr.begin(), arr.end());
    int mm;
    int r = m;
    int l = 1;
    int ans = -1;
    while(r >= l){
        mm = l + (r - l)/2;
        if(f(mm)){
            r = mm - 1;
            ans = mm;
        }
        else{
            l = mm + 1;
        }
    }
    f(ans);
    cout<<ans<<endl;
    for(int i=1;i<n+1;i++){
        for(auto t : day[i]) cout<<t+1<<" ";
        cout<<"0 \n";
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 2428 KB Output isn't correct
2 Incorrect 33 ms 2464 KB Output isn't correct
3 Incorrect 34 ms 2580 KB Output isn't correct
4 Incorrect 34 ms 2768 KB Output isn't correct
5 Incorrect 31 ms 2476 KB Output isn't correct
6 Incorrect 32 ms 2692 KB Output isn't correct
7 Incorrect 32 ms 2692 KB Output isn't correct
8 Incorrect 33 ms 2532 KB Output isn't correct
9 Incorrect 42 ms 5020 KB Expected EOLN
10 Incorrect 42 ms 4932 KB Expected EOLN
11 Incorrect 38 ms 2544 KB Expected EOLN
12 Incorrect 80 ms 4696 KB Expected EOLN
13 Incorrect 135 ms 6840 KB Expected EOLN
14 Incorrect 175 ms 9100 KB Expected EOLN
15 Incorrect 193 ms 9712 KB Output isn't correct
16 Incorrect 250 ms 14084 KB Expected EOLN
17 Incorrect 310 ms 16340 KB Expected EOLN
18 Incorrect 314 ms 17948 KB Expected EOLN
19 Incorrect 367 ms 20292 KB Expected EOLN
20 Incorrect 300 ms 16152 KB Expected EOLN