import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;
public class vision {
public void construct_network(int H, int W, int K) {
int commands = 0;
TreeSet<int[]> uniqueCommands = new TreeSet<int[]>(new ArrayComparator());
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
for (int k = i; k < H; k++) {
int remaining = K - k + i;
if (remaining >= 0) {
if (j + remaining < W) {
int[] command = {i * W + j, k * W + j + remaining};
uniqueCommands.add(command);
}
if (j - remaining >= 0) {
int[] command = {i * W + j, k * W + j - remaining};
//System.out.println(Arrays.toString(command));
uniqueCommands.add(command);
}
}
}
}
}
for (int[] command : uniqueCommands) {
grader.add_and(command);
commands++;
}
int[] command = new int[commands];
for (int i = H * W, j = 0; j < commands; i++, j++) command[j] = i;
grader.add_or(command);
}
private static class ArrayComparator implements Comparator<int[]> {
@Override
public int compare(int[] o1, int[] o2) {
int min1 = Math.min(o1[0], o1[1]);
int min2 = Math.min(o2[0], o2[1]);
int compare = Integer.compare(min1, min2);
if (compare != 0) return compare;
int max1 = Math.max(o1[0], o1[1]);
int max2 = Math.max(o2[0], o2[1]);
return Integer.compare(max1, max2);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
10480 KB |
Output is correct |
2 |
Correct |
80 ms |
10344 KB |
Output is correct |
3 |
Correct |
86 ms |
10508 KB |
Output is correct |
4 |
Correct |
88 ms |
10412 KB |
Output is correct |
5 |
Correct |
91 ms |
10432 KB |
Output is correct |
6 |
Correct |
84 ms |
10236 KB |
Output is correct |
7 |
Correct |
82 ms |
10616 KB |
Output is correct |
8 |
Correct |
85 ms |
10252 KB |
Output is correct |
9 |
Correct |
85 ms |
10308 KB |
Output is correct |
10 |
Correct |
85 ms |
10244 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
80 ms |
10360 KB |
Output is correct |
13 |
Correct |
88 ms |
10508 KB |
Output is correct |
14 |
Correct |
93 ms |
10600 KB |
Output is correct |
15 |
Correct |
82 ms |
10348 KB |
Output is correct |
16 |
Correct |
93 ms |
10384 KB |
Output is correct |
17 |
Correct |
82 ms |
10344 KB |
Output is correct |
18 |
Correct |
81 ms |
10360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
10480 KB |
Output is correct |
2 |
Correct |
80 ms |
10344 KB |
Output is correct |
3 |
Correct |
86 ms |
10508 KB |
Output is correct |
4 |
Correct |
88 ms |
10412 KB |
Output is correct |
5 |
Correct |
91 ms |
10432 KB |
Output is correct |
6 |
Correct |
84 ms |
10236 KB |
Output is correct |
7 |
Correct |
82 ms |
10616 KB |
Output is correct |
8 |
Correct |
85 ms |
10252 KB |
Output is correct |
9 |
Correct |
85 ms |
10308 KB |
Output is correct |
10 |
Correct |
85 ms |
10244 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
80 ms |
10360 KB |
Output is correct |
13 |
Correct |
88 ms |
10508 KB |
Output is correct |
14 |
Correct |
93 ms |
10600 KB |
Output is correct |
15 |
Correct |
82 ms |
10348 KB |
Output is correct |
16 |
Correct |
93 ms |
10384 KB |
Output is correct |
17 |
Correct |
82 ms |
10344 KB |
Output is correct |
18 |
Correct |
81 ms |
10360 KB |
Output is correct |
19 |
Correct |
89 ms |
10320 KB |
Output is correct |
20 |
Correct |
80 ms |
10360 KB |
Output is correct |
21 |
Correct |
97 ms |
10352 KB |
Output is correct |
22 |
Correct |
83 ms |
10236 KB |
Output is correct |
23 |
Correct |
106 ms |
10612 KB |
Output is correct |
24 |
Correct |
111 ms |
11644 KB |
Output is correct |
25 |
Correct |
100 ms |
11260 KB |
Output is correct |
26 |
Correct |
83 ms |
10360 KB |
Output is correct |
27 |
Correct |
82 ms |
10360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
10480 KB |
Output is correct |
2 |
Correct |
80 ms |
10344 KB |
Output is correct |
3 |
Correct |
86 ms |
10508 KB |
Output is correct |
4 |
Correct |
88 ms |
10412 KB |
Output is correct |
5 |
Correct |
91 ms |
10432 KB |
Output is correct |
6 |
Correct |
84 ms |
10236 KB |
Output is correct |
7 |
Correct |
82 ms |
10616 KB |
Output is correct |
8 |
Correct |
85 ms |
10252 KB |
Output is correct |
9 |
Correct |
85 ms |
10308 KB |
Output is correct |
10 |
Correct |
85 ms |
10244 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
80 ms |
10360 KB |
Output is correct |
13 |
Correct |
88 ms |
10508 KB |
Output is correct |
14 |
Correct |
93 ms |
10600 KB |
Output is correct |
15 |
Correct |
82 ms |
10348 KB |
Output is correct |
16 |
Correct |
93 ms |
10384 KB |
Output is correct |
17 |
Correct |
82 ms |
10344 KB |
Output is correct |
18 |
Correct |
81 ms |
10360 KB |
Output is correct |
19 |
Correct |
89 ms |
10320 KB |
Output is correct |
20 |
Correct |
80 ms |
10360 KB |
Output is correct |
21 |
Correct |
97 ms |
10352 KB |
Output is correct |
22 |
Correct |
83 ms |
10236 KB |
Output is correct |
23 |
Correct |
106 ms |
10612 KB |
Output is correct |
24 |
Correct |
111 ms |
11644 KB |
Output is correct |
25 |
Correct |
100 ms |
11260 KB |
Output is correct |
26 |
Correct |
83 ms |
10360 KB |
Output is correct |
27 |
Correct |
82 ms |
10360 KB |
Output is correct |
28 |
Incorrect |
169 ms |
14504 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
10480 KB |
Output is correct |
2 |
Correct |
80 ms |
10344 KB |
Output is correct |
3 |
Correct |
86 ms |
10508 KB |
Output is correct |
4 |
Correct |
88 ms |
10412 KB |
Output is correct |
5 |
Correct |
91 ms |
10432 KB |
Output is correct |
6 |
Correct |
84 ms |
10236 KB |
Output is correct |
7 |
Correct |
82 ms |
10616 KB |
Output is correct |
8 |
Correct |
85 ms |
10252 KB |
Output is correct |
9 |
Correct |
85 ms |
10308 KB |
Output is correct |
10 |
Correct |
85 ms |
10244 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
80 ms |
10360 KB |
Output is correct |
13 |
Correct |
88 ms |
10508 KB |
Output is correct |
14 |
Correct |
93 ms |
10600 KB |
Output is correct |
15 |
Correct |
82 ms |
10348 KB |
Output is correct |
16 |
Correct |
93 ms |
10384 KB |
Output is correct |
17 |
Correct |
82 ms |
10344 KB |
Output is correct |
18 |
Correct |
81 ms |
10360 KB |
Output is correct |
19 |
Correct |
89 ms |
10320 KB |
Output is correct |
20 |
Correct |
80 ms |
10360 KB |
Output is correct |
21 |
Correct |
97 ms |
10352 KB |
Output is correct |
22 |
Correct |
83 ms |
10236 KB |
Output is correct |
23 |
Correct |
106 ms |
10612 KB |
Output is correct |
24 |
Correct |
111 ms |
11644 KB |
Output is correct |
25 |
Correct |
100 ms |
11260 KB |
Output is correct |
26 |
Correct |
83 ms |
10360 KB |
Output is correct |
27 |
Correct |
82 ms |
10360 KB |
Output is correct |
28 |
Incorrect |
169 ms |
14504 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
10348 KB |
Output is correct |
2 |
Correct |
94 ms |
10384 KB |
Output is correct |
3 |
Correct |
89 ms |
10200 KB |
Output is correct |
4 |
Correct |
89 ms |
10372 KB |
Output is correct |
5 |
Correct |
95 ms |
10592 KB |
Output is correct |
6 |
Correct |
88 ms |
10232 KB |
Output is correct |
7 |
Correct |
97 ms |
10360 KB |
Output is correct |
8 |
Correct |
83 ms |
10228 KB |
Output is correct |
9 |
Correct |
92 ms |
10504 KB |
Output is correct |
10 |
Correct |
92 ms |
10468 KB |
Output is correct |
11 |
Correct |
86 ms |
10488 KB |
Output is correct |
12 |
Correct |
83 ms |
10228 KB |
Output is correct |
13 |
Correct |
84 ms |
10372 KB |
Output is correct |
14 |
Correct |
83 ms |
10332 KB |
Output is correct |
15 |
Correct |
91 ms |
10480 KB |
Output is correct |
16 |
Correct |
88 ms |
10360 KB |
Output is correct |
17 |
Correct |
87 ms |
10344 KB |
Output is correct |
18 |
Correct |
86 ms |
10488 KB |
Output is correct |
19 |
Correct |
90 ms |
10364 KB |
Output is correct |
20 |
Correct |
87 ms |
10356 KB |
Output is correct |
21 |
Correct |
87 ms |
10488 KB |
Output is correct |
22 |
Correct |
84 ms |
10516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
10164 KB |
Output is correct |
2 |
Correct |
83 ms |
10472 KB |
Output is correct |
3 |
Correct |
242 ms |
17140 KB |
Output is correct |
4 |
Incorrect |
213 ms |
19228 KB |
WA in grader: Too many instructions |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
253 ms |
21892 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
10480 KB |
Output is correct |
2 |
Correct |
80 ms |
10344 KB |
Output is correct |
3 |
Correct |
86 ms |
10508 KB |
Output is correct |
4 |
Correct |
88 ms |
10412 KB |
Output is correct |
5 |
Correct |
91 ms |
10432 KB |
Output is correct |
6 |
Correct |
84 ms |
10236 KB |
Output is correct |
7 |
Correct |
82 ms |
10616 KB |
Output is correct |
8 |
Correct |
85 ms |
10252 KB |
Output is correct |
9 |
Correct |
85 ms |
10308 KB |
Output is correct |
10 |
Correct |
85 ms |
10244 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
80 ms |
10360 KB |
Output is correct |
13 |
Correct |
88 ms |
10508 KB |
Output is correct |
14 |
Correct |
93 ms |
10600 KB |
Output is correct |
15 |
Correct |
82 ms |
10348 KB |
Output is correct |
16 |
Correct |
93 ms |
10384 KB |
Output is correct |
17 |
Correct |
82 ms |
10344 KB |
Output is correct |
18 |
Correct |
81 ms |
10360 KB |
Output is correct |
19 |
Correct |
89 ms |
10320 KB |
Output is correct |
20 |
Correct |
80 ms |
10360 KB |
Output is correct |
21 |
Correct |
97 ms |
10352 KB |
Output is correct |
22 |
Correct |
83 ms |
10236 KB |
Output is correct |
23 |
Correct |
106 ms |
10612 KB |
Output is correct |
24 |
Correct |
111 ms |
11644 KB |
Output is correct |
25 |
Correct |
100 ms |
11260 KB |
Output is correct |
26 |
Correct |
83 ms |
10360 KB |
Output is correct |
27 |
Correct |
82 ms |
10360 KB |
Output is correct |
28 |
Incorrect |
169 ms |
14504 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |