#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 < n; 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 (arr[in].first < i - d)
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";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
1380 KB |
Output isn't correct |
2 |
Incorrect |
13 ms |
1528 KB |
Output isn't correct |
3 |
Incorrect |
11 ms |
1504 KB |
Output isn't correct |
4 |
Incorrect |
9 ms |
1368 KB |
Output isn't correct |
5 |
Incorrect |
9 ms |
1368 KB |
Output isn't correct |
6 |
Incorrect |
10 ms |
1372 KB |
Output isn't correct |
7 |
Incorrect |
9 ms |
1372 KB |
Output isn't correct |
8 |
Incorrect |
9 ms |
1372 KB |
Output isn't correct |
9 |
Incorrect |
23 ms |
3664 KB |
Output isn't correct |
10 |
Incorrect |
24 ms |
3572 KB |
Output isn't correct |
11 |
Incorrect |
11 ms |
1372 KB |
Output isn't correct |
12 |
Incorrect |
17 ms |
2396 KB |
Output isn't correct |
13 |
Incorrect |
38 ms |
3412 KB |
Output isn't correct |
14 |
Incorrect |
42 ms |
4416 KB |
Output isn't correct |
15 |
Incorrect |
66 ms |
5144 KB |
Output isn't correct |
16 |
Incorrect |
58 ms |
6360 KB |
Output isn't correct |
17 |
Incorrect |
83 ms |
7316 KB |
Output isn't correct |
18 |
Incorrect |
82 ms |
8344 KB |
Output isn't correct |
19 |
Incorrect |
85 ms |
10248 KB |
Output isn't correct |
20 |
Incorrect |
85 ms |
7284 KB |
Output isn't correct |