#include <bits/stdc++.h>
using namespace std;
const int maxm = 1000000;
pair<int, int> arr[maxm];
int main()
{
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int n, d, m;
cin >> n >> d >> m;
for (int i = 0; i < m; i++)
{
cin >> arr[i].first;
arr[i].first--;
arr[i].second = i;
}
sort(arr, arr + m);
int l = 1, r = 2000000;
while (l < r)
{
int mid = (l + r) / 2;
int in = 0;
for (int i = 0; i < n; i++)
{
if (in != m)
if (arr[in].first < i - 2)
goto A;
int ct = 0;
while (ct < mid && in < m)
{
if (arr[in].first <= i)
{
ct++;
in++;
}
else
break;
}
}
if (in == m)
{
r = mid;
continue;
}
A:;
l = mid + 1;
}
cout << l << "\n";
int in2 = 0;
for (int i = 0; i < n; i++)
{
int ct = 0;
while (ct < l && in2 < m)
{
if (arr[in2].first <= i)
{
cout << arr[in2].second + 1 << ' ';
ct++;
in2++;
}
else
break;
}
cout << "0\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
3420 KB |
Output isn't correct |
2 |
Incorrect |
13 ms |
3420 KB |
Output isn't correct |
3 |
Incorrect |
14 ms |
3512 KB |
Output isn't correct |
4 |
Incorrect |
14 ms |
3552 KB |
Output isn't correct |
5 |
Incorrect |
15 ms |
3548 KB |
Output isn't correct |
6 |
Incorrect |
15 ms |
3560 KB |
Output isn't correct |
7 |
Incorrect |
16 ms |
3588 KB |
Output isn't correct |
8 |
Incorrect |
14 ms |
3404 KB |
Output isn't correct |
9 |
Incorrect |
23 ms |
3668 KB |
Output isn't correct |
10 |
Correct |
26 ms |
3668 KB |
Output is correct |
11 |
Incorrect |
23 ms |
3596 KB |
Output isn't correct |
12 |
Incorrect |
42 ms |
4692 KB |
Output isn't correct |
13 |
Incorrect |
67 ms |
7808 KB |
Output isn't correct |
14 |
Incorrect |
94 ms |
9296 KB |
Output isn't correct |
15 |
Correct |
110 ms |
9956 KB |
Output is correct |
16 |
Incorrect |
133 ms |
13756 KB |
Output isn't correct |
17 |
Incorrect |
169 ms |
14712 KB |
Output isn't correct |
18 |
Incorrect |
177 ms |
15196 KB |
Output isn't correct |
19 |
Incorrect |
201 ms |
17140 KB |
Output isn't correct |
20 |
Incorrect |
164 ms |
14848 KB |
Output isn't correct |