#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdint>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t maxn = 1000000;
int64_t n, d, m;
Pair a[maxn];
int main()
{
ios_base::sync_with_stdio(false);
cin >> n >> d >> m;
for (int64_t i = 0; i < m; i++)
{
cin >> a[i].first;
a[i].second = i + 1;
}
sort(a, a + m);
int64_t l = 1, r = m;
while (l < r)
{
int64_t k = (l + r) / 2;
bool result = true;
for (int64_t i = 0; i * k < m; i++)
{
if (i >= a[i * k].first + d || i >= n)
{
result = false;
break;
}
}
if (result)
r = k;
else
l = k + 1;
}
cout << l << '\n';
for (int64_t i = 0; i < n; i++)
{
for (int64_t j = i * l; j < min(m, (i + 1) * l); j++)
cout << a[j].second << ' ';
cout << "0\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
3160 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
3164 KB |
Output isn't correct |
3 |
Incorrect |
12 ms |
3208 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
3164 KB |
Output isn't correct |
5 |
Incorrect |
11 ms |
3164 KB |
Output isn't correct |
6 |
Incorrect |
12 ms |
3160 KB |
Output isn't correct |
7 |
Incorrect |
12 ms |
3208 KB |
Output isn't correct |
8 |
Incorrect |
12 ms |
3164 KB |
Output isn't correct |
9 |
Correct |
20 ms |
3420 KB |
Output is correct |
10 |
Correct |
21 ms |
3412 KB |
Output is correct |
11 |
Correct |
19 ms |
3164 KB |
Output is correct |
12 |
Correct |
38 ms |
5968 KB |
Output is correct |
13 |
Correct |
58 ms |
8584 KB |
Output is correct |
14 |
Correct |
80 ms |
9344 KB |
Output is correct |
15 |
Incorrect |
96 ms |
12168 KB |
Output isn't correct |
16 |
Correct |
122 ms |
14932 KB |
Output is correct |
17 |
Correct |
146 ms |
17748 KB |
Output is correct |
18 |
Correct |
156 ms |
20360 KB |
Output is correct |
19 |
Correct |
177 ms |
21328 KB |
Output is correct |
20 |
Correct |
147 ms |
17944 KB |
Output is correct |