제출 #567650

#제출 시각아이디문제언어결과실행 시간메모리
567650gcconureJob Scheduling (CEOI12_jobs)C++17
4 / 100
1054 ms45664 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    int n,m,d; cin >> n >> d >> m;
    
    multiset<pair<int,int>> v;
    for(int i = 0; i < m; i++){
        int x; cin >> x;
        v.insert({x,i});
    }
    
    
    int machines = 0;
    vector<int> days[n+1];
    while(!v.empty()){
        machines++;
        int day = 0;
        while(day<=n){
            day++;
            auto a = v.lower_bound({day-d,1000000});
            days[day].push_back((*a).second);
            if(a==end(v)){
                break;
            }
            v.erase(v.lower_bound(*a)); 
        }
    }
    cout << machines << "\n";
    for(int i = 1; i <=n; i++){
        for(int j:days[i]){
            cout << j+1 << " ";
        }
        cout << 0;
        cout << "\n";
    }
    // cout << machines << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...