#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 = ceil((float)m / (float)n), r = n;
while (l < r)
{
int64_t k = (l + r) / 2;
bool result = true;
for (int64_t i = 0; i * k < n; i++)
{
if (a[i * k].first + d < i)
{
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 |
20 ms |
3164 KB |
Output isn't correct |
2 |
Incorrect |
12 ms |
3212 KB |
Output isn't correct |
3 |
Incorrect |
20 ms |
3164 KB |
Output isn't correct |
4 |
Incorrect |
12 ms |
3164 KB |
Output isn't correct |
5 |
Incorrect |
20 ms |
3164 KB |
Output isn't correct |
6 |
Incorrect |
13 ms |
3416 KB |
Output isn't correct |
7 |
Incorrect |
14 ms |
3416 KB |
Output isn't correct |
8 |
Incorrect |
20 ms |
3420 KB |
Output isn't correct |
9 |
Incorrect |
27 ms |
3468 KB |
Output isn't correct |
10 |
Incorrect |
21 ms |
3664 KB |
Output isn't correct |
11 |
Incorrect |
27 ms |
3420 KB |
Output isn't correct |
12 |
Correct |
44 ms |
6600 KB |
Output is correct |
13 |
Incorrect |
63 ms |
9436 KB |
Output isn't correct |
14 |
Correct |
96 ms |
10780 KB |
Output is correct |
15 |
Incorrect |
105 ms |
13436 KB |
Output isn't correct |
16 |
Incorrect |
128 ms |
16764 KB |
Output isn't correct |
17 |
Incorrect |
177 ms |
19584 KB |
Output isn't correct |
18 |
Incorrect |
167 ms |
22096 KB |
Output isn't correct |
19 |
Incorrect |
186 ms |
23004 KB |
Output isn't correct |
20 |
Incorrect |
146 ms |
19332 KB |
Output isn't correct |