답안 #856997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
856997 2023-10-05T07:35:38 Z AminMDNZ Job Scheduling (CEOI12_jobs) C++14
0 / 100
1000 ms 58880 KB
#include<bits/stdc++.h>
using namespace std;
vector<pair<int, int>> arr;
int n, m , d;
map<int, set<int>> day;
map<int, int> mac;
bool f(int mm){
    mac.clear();
    day.clear();
    set<int> s;
    for(int i=1;i<n+1;i++) day[i] = s;
    int del = 0;
    mac[1] += mm;
    for(int i=0;i<m;i++){
        auto it = mac.lower_bound(-1);
        int r = (*it).first;
        del = max(r - arr[i].first, d);
        day[r].insert(arr[i].second);
        mac[r + 1]++;
        if(mac[r] > 1) mac[r]--;
        else mac.erase(r);
    }
    return del <= d;
}

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(auto i : day){
        for(auto t : i.second) cout<<t+1<<" ";
        cout<<"0 \n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 206 ms 7608 KB Output isn't correct
2 Incorrect 208 ms 7612 KB Output isn't correct
3 Incorrect 195 ms 7608 KB Output isn't correct
4 Incorrect 199 ms 7352 KB Output isn't correct
5 Incorrect 204 ms 7356 KB Output isn't correct
6 Incorrect 206 ms 7420 KB Output isn't correct
7 Incorrect 186 ms 7356 KB Output isn't correct
8 Incorrect 200 ms 7508 KB Output isn't correct
9 Incorrect 592 ms 16312 KB Expected EOLN
10 Incorrect 612 ms 16328 KB Expected EOLN
11 Incorrect 237 ms 6784 KB Output isn't correct
12 Incorrect 530 ms 12760 KB Expected EOLN
13 Incorrect 988 ms 18748 KB Output isn't correct
14 Execution timed out 1047 ms 23376 KB Time limit exceeded
15 Execution timed out 1030 ms 27716 KB Time limit exceeded
16 Execution timed out 1030 ms 34128 KB Time limit exceeded
17 Execution timed out 1041 ms 39508 KB Time limit exceeded
18 Execution timed out 1072 ms 45364 KB Time limit exceeded
19 Execution timed out 1069 ms 58880 KB Time limit exceeded
20 Execution timed out 1038 ms 39504 KB Time limit exceeded