제출 #1280903

#제출 시각아이디문제언어결과실행 시간메모리
1280903SSKMFJob Scheduling (CEOI12_jobs)C++20
55 / 100
159 ms13888 KiB
#include <bits/stdc++.h>
using namespace std;

pair <int , int> moment[1000001];

int main ()
{
    ios :: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int durata , termen , lungime;
    cin >> durata >> termen >> lungime;

    for (int indice = 0 ; indice < lungime ; indice++)
        { cin >> moment[indice].first; moment[indice].second = indice + 1; }
    
    sort(moment , moment + lungime);

    int maxim = 0;
    for (int indice = 0 ; indice < lungime ; indice++)
        { maxim = max(maxim , indice / (moment[indice].first + termen) + 1); }

    cout << maxim << '\n';

    for (int indice = 0 , __indice = 0 ; indice < durata ; indice++)
    {
        for (int ramas = maxim ; ramas && __indice < lungime ; ramas-- , __indice++)
            { cout << moment[__indice].second << ' '; }

        cout << "0\n";
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...