import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class jobs {
static class Pair {
int fr, sc;
Pair(int fr, int sc) {
this.fr = fr;
this.sc = sc;
}
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] firstLine = br.readLine().split(" ");
int n = Integer.parseInt(firstLine[0]);
int d = Integer.parseInt(firstLine[1]);
int m = Integer.parseInt(firstLine[2]);
Pair[] a = new Pair[m + 2];
for (int i = 1; i <= m; i++) {
int value = Integer.parseInt(br.readLine().split(" ")[i - 1]);
a[i] = new Pair(value, i);
}
a[m + 1] = new Pair(1000000000, 0);
Arrays.sort(a, 1, m + 1, (x, y) -> Integer.compare(x.fr, y.fr));
int l = 0, r = m;
while (r - l > 1) {
int mid = (l + r) / 2, p = 1;
for (int i = 1; i <= n; i++) {
if (a[p].fr + d < i) {
break;
}
int cnt = 0;
while (cnt < mid && a[p].fr <= i) {
cnt++;
p++;
}
}
if (p > m) {
r = mid;
} else {
l = mid;
}
}
System.out.println(r);
int p = 1;
for (int i = 1; i <= n; i++) {
int cnt = 0;
while (cnt < r && a[p].fr <= i) {
cnt++;
System.out.print(a[p].sc + " ");
p++;
}
System.out.println(0);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
180 ms |
20384 KB |
Execution failed because the return code was nonzero |
2 |
Runtime error |
179 ms |
20864 KB |
Execution failed because the return code was nonzero |
3 |
Runtime error |
183 ms |
20396 KB |
Execution failed because the return code was nonzero |
4 |
Runtime error |
193 ms |
20524 KB |
Execution failed because the return code was nonzero |
5 |
Runtime error |
167 ms |
20840 KB |
Execution failed because the return code was nonzero |
6 |
Runtime error |
184 ms |
20888 KB |
Execution failed because the return code was nonzero |
7 |
Runtime error |
185 ms |
20432 KB |
Execution failed because the return code was nonzero |
8 |
Runtime error |
188 ms |
20604 KB |
Execution failed because the return code was nonzero |
9 |
Runtime error |
165 ms |
18380 KB |
Execution failed because the return code was nonzero |
10 |
Runtime error |
173 ms |
18200 KB |
Execution failed because the return code was nonzero |
11 |
Runtime error |
184 ms |
20408 KB |
Execution failed because the return code was nonzero |
12 |
Runtime error |
214 ms |
27268 KB |
Execution failed because the return code was nonzero |
13 |
Runtime error |
237 ms |
36188 KB |
Execution failed because the return code was nonzero |
14 |
Runtime error |
234 ms |
40688 KB |
Execution failed because the return code was nonzero |
15 |
Runtime error |
246 ms |
48440 KB |
Execution failed because the return code was nonzero |
16 |
Runtime error |
343 ms |
65536 KB |
Execution failed because the return code was nonzero |
17 |
Runtime error |
279 ms |
64612 KB |
Execution failed because the return code was nonzero |
18 |
Runtime error |
313 ms |
65536 KB |
Execution killed with signal 9 |
19 |
Runtime error |
306 ms |
65536 KB |
Execution killed with signal 9 |
20 |
Runtime error |
272 ms |
62936 KB |
Execution failed because the return code was nonzero |