#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 time | Memory | Grader output |
---|
Fetching results... |