답안 #856995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
856995 2023-10-05T07:30:37 Z AminMDNZ Job Scheduling (CEOI12_jobs) C++14
0 / 100
1000 ms 49492 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();
    int del = 0;
    mac[1] += mm;
    for(int i=0;i<m;i++){
        auto it = mac.lower_bound(-1);
        int r = (*it).first;
        // cout<<(*it).first<<endl;
        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);
    for(auto i : day){
        for(auto t : i.second) cout<<t+1<<" ";
        cout<<"0 \n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 174 ms 6484 KB Expected EOLN
2 Incorrect 176 ms 6672 KB Expected EOLN
3 Incorrect 162 ms 6480 KB Expected EOLN
4 Incorrect 167 ms 6424 KB Expected EOLN
5 Incorrect 167 ms 6480 KB Expected EOLN
6 Incorrect 176 ms 6420 KB Expected EOLN
7 Incorrect 157 ms 6420 KB Expected EOLN
8 Incorrect 156 ms 6432 KB Expected EOLN
9 Incorrect 195 ms 6668 KB Expected EOLN
10 Incorrect 182 ms 6672 KB Expected EOLN
11 Incorrect 219 ms 6484 KB Expected EOLN
12 Incorrect 505 ms 12660 KB Expected EOLN
13 Incorrect 905 ms 18952 KB Expected EOLN
14 Execution timed out 1041 ms 23084 KB Time limit exceeded
15 Execution timed out 1042 ms 27984 KB Time limit exceeded
16 Execution timed out 1061 ms 33280 KB Time limit exceeded
17 Execution timed out 1037 ms 38776 KB Time limit exceeded
18 Execution timed out 1076 ms 44116 KB Time limit exceeded
19 Execution timed out 1056 ms 49492 KB Time limit exceeded
20 Execution timed out 1051 ms 38736 KB Time limit exceeded