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());
if ((H <= 10 && W <= 10) || (Math.min(H, W) == 1)) {
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);
}
}
}
}
}
} else {
int j = 0;
int i = 0;
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 |
91 ms |
10352 KB |
Output is correct |
2 |
Correct |
87 ms |
10352 KB |
Output is correct |
3 |
Correct |
87 ms |
10728 KB |
Output is correct |
4 |
Correct |
85 ms |
10256 KB |
Output is correct |
5 |
Correct |
89 ms |
10344 KB |
Output is correct |
6 |
Correct |
99 ms |
10484 KB |
Output is correct |
7 |
Correct |
84 ms |
10508 KB |
Output is correct |
8 |
Correct |
86 ms |
10228 KB |
Output is correct |
9 |
Correct |
82 ms |
10212 KB |
Output is correct |
10 |
Correct |
82 ms |
10172 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
87 ms |
10136 KB |
Output is correct |
13 |
Correct |
85 ms |
10268 KB |
Output is correct |
14 |
Correct |
84 ms |
10360 KB |
Output is correct |
15 |
Correct |
82 ms |
10360 KB |
Output is correct |
16 |
Correct |
85 ms |
10460 KB |
Output is correct |
17 |
Correct |
89 ms |
10444 KB |
Output is correct |
18 |
Correct |
84 ms |
10260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
10352 KB |
Output is correct |
2 |
Correct |
87 ms |
10352 KB |
Output is correct |
3 |
Correct |
87 ms |
10728 KB |
Output is correct |
4 |
Correct |
85 ms |
10256 KB |
Output is correct |
5 |
Correct |
89 ms |
10344 KB |
Output is correct |
6 |
Correct |
99 ms |
10484 KB |
Output is correct |
7 |
Correct |
84 ms |
10508 KB |
Output is correct |
8 |
Correct |
86 ms |
10228 KB |
Output is correct |
9 |
Correct |
82 ms |
10212 KB |
Output is correct |
10 |
Correct |
82 ms |
10172 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
87 ms |
10136 KB |
Output is correct |
13 |
Correct |
85 ms |
10268 KB |
Output is correct |
14 |
Correct |
84 ms |
10360 KB |
Output is correct |
15 |
Correct |
82 ms |
10360 KB |
Output is correct |
16 |
Correct |
85 ms |
10460 KB |
Output is correct |
17 |
Correct |
89 ms |
10444 KB |
Output is correct |
18 |
Correct |
84 ms |
10260 KB |
Output is correct |
19 |
Correct |
81 ms |
10360 KB |
Output is correct |
20 |
Correct |
81 ms |
10340 KB |
Output is correct |
21 |
Correct |
93 ms |
10232 KB |
Output is correct |
22 |
Correct |
82 ms |
10228 KB |
Output is correct |
23 |
Correct |
89 ms |
10616 KB |
Output is correct |
24 |
Correct |
109 ms |
11896 KB |
Output is correct |
25 |
Correct |
98 ms |
11352 KB |
Output is correct |
26 |
Correct |
90 ms |
10296 KB |
Output is correct |
27 |
Correct |
86 ms |
10360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
10352 KB |
Output is correct |
2 |
Correct |
87 ms |
10352 KB |
Output is correct |
3 |
Correct |
87 ms |
10728 KB |
Output is correct |
4 |
Correct |
85 ms |
10256 KB |
Output is correct |
5 |
Correct |
89 ms |
10344 KB |
Output is correct |
6 |
Correct |
99 ms |
10484 KB |
Output is correct |
7 |
Correct |
84 ms |
10508 KB |
Output is correct |
8 |
Correct |
86 ms |
10228 KB |
Output is correct |
9 |
Correct |
82 ms |
10212 KB |
Output is correct |
10 |
Correct |
82 ms |
10172 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
87 ms |
10136 KB |
Output is correct |
13 |
Correct |
85 ms |
10268 KB |
Output is correct |
14 |
Correct |
84 ms |
10360 KB |
Output is correct |
15 |
Correct |
82 ms |
10360 KB |
Output is correct |
16 |
Correct |
85 ms |
10460 KB |
Output is correct |
17 |
Correct |
89 ms |
10444 KB |
Output is correct |
18 |
Correct |
84 ms |
10260 KB |
Output is correct |
19 |
Correct |
81 ms |
10360 KB |
Output is correct |
20 |
Correct |
81 ms |
10340 KB |
Output is correct |
21 |
Correct |
93 ms |
10232 KB |
Output is correct |
22 |
Correct |
82 ms |
10228 KB |
Output is correct |
23 |
Correct |
89 ms |
10616 KB |
Output is correct |
24 |
Correct |
109 ms |
11896 KB |
Output is correct |
25 |
Correct |
98 ms |
11352 KB |
Output is correct |
26 |
Correct |
90 ms |
10296 KB |
Output is correct |
27 |
Correct |
86 ms |
10360 KB |
Output is correct |
28 |
Incorrect |
92 ms |
10360 KB |
on inputs (3, 13), (11, 6), expected 1, but computed 0 |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
10352 KB |
Output is correct |
2 |
Correct |
87 ms |
10352 KB |
Output is correct |
3 |
Correct |
87 ms |
10728 KB |
Output is correct |
4 |
Correct |
85 ms |
10256 KB |
Output is correct |
5 |
Correct |
89 ms |
10344 KB |
Output is correct |
6 |
Correct |
99 ms |
10484 KB |
Output is correct |
7 |
Correct |
84 ms |
10508 KB |
Output is correct |
8 |
Correct |
86 ms |
10228 KB |
Output is correct |
9 |
Correct |
82 ms |
10212 KB |
Output is correct |
10 |
Correct |
82 ms |
10172 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
87 ms |
10136 KB |
Output is correct |
13 |
Correct |
85 ms |
10268 KB |
Output is correct |
14 |
Correct |
84 ms |
10360 KB |
Output is correct |
15 |
Correct |
82 ms |
10360 KB |
Output is correct |
16 |
Correct |
85 ms |
10460 KB |
Output is correct |
17 |
Correct |
89 ms |
10444 KB |
Output is correct |
18 |
Correct |
84 ms |
10260 KB |
Output is correct |
19 |
Correct |
81 ms |
10360 KB |
Output is correct |
20 |
Correct |
81 ms |
10340 KB |
Output is correct |
21 |
Correct |
93 ms |
10232 KB |
Output is correct |
22 |
Correct |
82 ms |
10228 KB |
Output is correct |
23 |
Correct |
89 ms |
10616 KB |
Output is correct |
24 |
Correct |
109 ms |
11896 KB |
Output is correct |
25 |
Correct |
98 ms |
11352 KB |
Output is correct |
26 |
Correct |
90 ms |
10296 KB |
Output is correct |
27 |
Correct |
86 ms |
10360 KB |
Output is correct |
28 |
Incorrect |
92 ms |
10360 KB |
on inputs (3, 13), (11, 6), expected 1, but computed 0 |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
10488 KB |
Output is correct |
2 |
Correct |
92 ms |
10504 KB |
Output is correct |
3 |
Correct |
93 ms |
10380 KB |
Output is correct |
4 |
Correct |
94 ms |
10360 KB |
Output is correct |
5 |
Correct |
100 ms |
10488 KB |
Output is correct |
6 |
Correct |
93 ms |
10360 KB |
Output is correct |
7 |
Correct |
92 ms |
10468 KB |
Output is correct |
8 |
Correct |
88 ms |
10208 KB |
Output is correct |
9 |
Correct |
102 ms |
10576 KB |
Output is correct |
10 |
Correct |
101 ms |
10380 KB |
Output is correct |
11 |
Correct |
86 ms |
10012 KB |
Output is correct |
12 |
Correct |
86 ms |
10236 KB |
Output is correct |
13 |
Correct |
85 ms |
10360 KB |
Output is correct |
14 |
Correct |
84 ms |
10472 KB |
Output is correct |
15 |
Correct |
97 ms |
10536 KB |
Output is correct |
16 |
Correct |
90 ms |
10600 KB |
Output is correct |
17 |
Correct |
85 ms |
10232 KB |
Output is correct |
18 |
Correct |
89 ms |
10356 KB |
Output is correct |
19 |
Correct |
88 ms |
10104 KB |
Output is correct |
20 |
Correct |
86 ms |
10396 KB |
Output is correct |
21 |
Correct |
84 ms |
10528 KB |
Output is correct |
22 |
Correct |
81 ms |
10272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
85 ms |
10508 KB |
Output is correct |
2 |
Correct |
84 ms |
10236 KB |
Output is correct |
3 |
Correct |
83 ms |
10436 KB |
Output is correct |
4 |
Correct |
84 ms |
10344 KB |
Output is correct |
5 |
Correct |
90 ms |
10356 KB |
Output is correct |
6 |
Correct |
84 ms |
10356 KB |
Output is correct |
7 |
Correct |
85 ms |
10360 KB |
Output is correct |
8 |
Correct |
84 ms |
10360 KB |
Output is correct |
9 |
Correct |
84 ms |
10472 KB |
Output is correct |
10 |
Correct |
80 ms |
10488 KB |
Output is correct |
11 |
Correct |
84 ms |
10356 KB |
Output is correct |
12 |
Correct |
83 ms |
10388 KB |
Output is correct |
13 |
Correct |
90 ms |
10600 KB |
Output is correct |
14 |
Correct |
91 ms |
10560 KB |
Output is correct |
15 |
Correct |
84 ms |
10488 KB |
Output is correct |
16 |
Correct |
88 ms |
10164 KB |
Output is correct |
17 |
Correct |
97 ms |
10620 KB |
Output is correct |
18 |
Correct |
96 ms |
10252 KB |
Output is correct |
19 |
Correct |
89 ms |
10428 KB |
Output is correct |
20 |
Correct |
88 ms |
10144 KB |
Output is correct |
21 |
Correct |
90 ms |
10488 KB |
Output is correct |
22 |
Correct |
92 ms |
10484 KB |
Output is correct |
23 |
Correct |
84 ms |
10232 KB |
Output is correct |
24 |
Correct |
101 ms |
10396 KB |
Output is correct |
25 |
Correct |
93 ms |
10104 KB |
Output is correct |
26 |
Correct |
92 ms |
10236 KB |
Output is correct |
27 |
Correct |
87 ms |
10232 KB |
Output is correct |
28 |
Correct |
90 ms |
10720 KB |
Output is correct |
29 |
Correct |
97 ms |
10356 KB |
Output is correct |
30 |
Correct |
96 ms |
10448 KB |
Output is correct |
31 |
Correct |
86 ms |
10476 KB |
Output is correct |
32 |
Correct |
83 ms |
10360 KB |
Output is correct |
33 |
Correct |
91 ms |
10472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
81 ms |
10472 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
10352 KB |
Output is correct |
2 |
Correct |
87 ms |
10352 KB |
Output is correct |
3 |
Correct |
87 ms |
10728 KB |
Output is correct |
4 |
Correct |
85 ms |
10256 KB |
Output is correct |
5 |
Correct |
89 ms |
10344 KB |
Output is correct |
6 |
Correct |
99 ms |
10484 KB |
Output is correct |
7 |
Correct |
84 ms |
10508 KB |
Output is correct |
8 |
Correct |
86 ms |
10228 KB |
Output is correct |
9 |
Correct |
82 ms |
10212 KB |
Output is correct |
10 |
Correct |
82 ms |
10172 KB |
Output is correct |
11 |
Correct |
82 ms |
10252 KB |
Output is correct |
12 |
Correct |
87 ms |
10136 KB |
Output is correct |
13 |
Correct |
85 ms |
10268 KB |
Output is correct |
14 |
Correct |
84 ms |
10360 KB |
Output is correct |
15 |
Correct |
82 ms |
10360 KB |
Output is correct |
16 |
Correct |
85 ms |
10460 KB |
Output is correct |
17 |
Correct |
89 ms |
10444 KB |
Output is correct |
18 |
Correct |
84 ms |
10260 KB |
Output is correct |
19 |
Correct |
81 ms |
10360 KB |
Output is correct |
20 |
Correct |
81 ms |
10340 KB |
Output is correct |
21 |
Correct |
93 ms |
10232 KB |
Output is correct |
22 |
Correct |
82 ms |
10228 KB |
Output is correct |
23 |
Correct |
89 ms |
10616 KB |
Output is correct |
24 |
Correct |
109 ms |
11896 KB |
Output is correct |
25 |
Correct |
98 ms |
11352 KB |
Output is correct |
26 |
Correct |
90 ms |
10296 KB |
Output is correct |
27 |
Correct |
86 ms |
10360 KB |
Output is correct |
28 |
Incorrect |
92 ms |
10360 KB |
on inputs (3, 13), (11, 6), expected 1, but computed 0 |
29 |
Halted |
0 ms |
0 KB |
- |