Submission #262961

# Submission time Handle Problem Language Result Execution time Memory
262961 2020-08-13T11:32:21 Z idk321 Vision Program (IOI19_vision) Java 11
29 / 100
113 ms 11488 KB
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) {
			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 79 ms 10348 KB Output is correct
2 Correct 77 ms 10360 KB Output is correct
3 Correct 82 ms 10356 KB Output is correct
4 Correct 79 ms 10232 KB Output is correct
5 Correct 81 ms 10600 KB Output is correct
6 Correct 82 ms 10380 KB Output is correct
7 Correct 81 ms 10368 KB Output is correct
8 Correct 79 ms 10344 KB Output is correct
9 Correct 79 ms 10216 KB Output is correct
10 Correct 83 ms 10428 KB Output is correct
11 Correct 82 ms 10140 KB Output is correct
12 Correct 91 ms 10248 KB Output is correct
13 Correct 83 ms 10636 KB Output is correct
14 Correct 82 ms 10276 KB Output is correct
15 Correct 80 ms 10256 KB Output is correct
16 Correct 79 ms 10432 KB Output is correct
17 Correct 92 ms 10184 KB Output is correct
18 Correct 84 ms 10228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 10348 KB Output is correct
2 Correct 77 ms 10360 KB Output is correct
3 Correct 82 ms 10356 KB Output is correct
4 Correct 79 ms 10232 KB Output is correct
5 Correct 81 ms 10600 KB Output is correct
6 Correct 82 ms 10380 KB Output is correct
7 Correct 81 ms 10368 KB Output is correct
8 Correct 79 ms 10344 KB Output is correct
9 Correct 79 ms 10216 KB Output is correct
10 Correct 83 ms 10428 KB Output is correct
11 Correct 82 ms 10140 KB Output is correct
12 Correct 91 ms 10248 KB Output is correct
13 Correct 83 ms 10636 KB Output is correct
14 Correct 82 ms 10276 KB Output is correct
15 Correct 80 ms 10256 KB Output is correct
16 Correct 79 ms 10432 KB Output is correct
17 Correct 92 ms 10184 KB Output is correct
18 Correct 84 ms 10228 KB Output is correct
19 Correct 94 ms 10308 KB Output is correct
20 Correct 83 ms 10368 KB Output is correct
21 Correct 93 ms 10344 KB Output is correct
22 Correct 96 ms 10332 KB Output is correct
23 Correct 95 ms 10252 KB Output is correct
24 Correct 110 ms 11488 KB Output is correct
25 Correct 101 ms 11280 KB Output is correct
26 Correct 108 ms 10368 KB Output is correct
27 Correct 96 ms 10400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 10348 KB Output is correct
2 Correct 77 ms 10360 KB Output is correct
3 Correct 82 ms 10356 KB Output is correct
4 Correct 79 ms 10232 KB Output is correct
5 Correct 81 ms 10600 KB Output is correct
6 Correct 82 ms 10380 KB Output is correct
7 Correct 81 ms 10368 KB Output is correct
8 Correct 79 ms 10344 KB Output is correct
9 Correct 79 ms 10216 KB Output is correct
10 Correct 83 ms 10428 KB Output is correct
11 Correct 82 ms 10140 KB Output is correct
12 Correct 91 ms 10248 KB Output is correct
13 Correct 83 ms 10636 KB Output is correct
14 Correct 82 ms 10276 KB Output is correct
15 Correct 80 ms 10256 KB Output is correct
16 Correct 79 ms 10432 KB Output is correct
17 Correct 92 ms 10184 KB Output is correct
18 Correct 84 ms 10228 KB Output is correct
19 Correct 94 ms 10308 KB Output is correct
20 Correct 83 ms 10368 KB Output is correct
21 Correct 93 ms 10344 KB Output is correct
22 Correct 96 ms 10332 KB Output is correct
23 Correct 95 ms 10252 KB Output is correct
24 Correct 110 ms 11488 KB Output is correct
25 Correct 101 ms 11280 KB Output is correct
26 Correct 108 ms 10368 KB Output is correct
27 Correct 96 ms 10400 KB Output is correct
28 Incorrect 91 ms 10380 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 79 ms 10348 KB Output is correct
2 Correct 77 ms 10360 KB Output is correct
3 Correct 82 ms 10356 KB Output is correct
4 Correct 79 ms 10232 KB Output is correct
5 Correct 81 ms 10600 KB Output is correct
6 Correct 82 ms 10380 KB Output is correct
7 Correct 81 ms 10368 KB Output is correct
8 Correct 79 ms 10344 KB Output is correct
9 Correct 79 ms 10216 KB Output is correct
10 Correct 83 ms 10428 KB Output is correct
11 Correct 82 ms 10140 KB Output is correct
12 Correct 91 ms 10248 KB Output is correct
13 Correct 83 ms 10636 KB Output is correct
14 Correct 82 ms 10276 KB Output is correct
15 Correct 80 ms 10256 KB Output is correct
16 Correct 79 ms 10432 KB Output is correct
17 Correct 92 ms 10184 KB Output is correct
18 Correct 84 ms 10228 KB Output is correct
19 Correct 94 ms 10308 KB Output is correct
20 Correct 83 ms 10368 KB Output is correct
21 Correct 93 ms 10344 KB Output is correct
22 Correct 96 ms 10332 KB Output is correct
23 Correct 95 ms 10252 KB Output is correct
24 Correct 110 ms 11488 KB Output is correct
25 Correct 101 ms 11280 KB Output is correct
26 Correct 108 ms 10368 KB Output is correct
27 Correct 96 ms 10400 KB Output is correct
28 Incorrect 91 ms 10380 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 Incorrect 100 ms 10280 KB on inputs (0, 1), (0, 2), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 113 ms 10348 KB Output is correct
2 Correct 100 ms 10252 KB Output is correct
3 Correct 87 ms 10244 KB Output is correct
4 Correct 85 ms 10380 KB Output is correct
5 Correct 88 ms 10084 KB Output is correct
6 Correct 88 ms 10452 KB Output is correct
7 Correct 89 ms 10236 KB Output is correct
8 Correct 93 ms 10348 KB Output is correct
9 Correct 87 ms 10232 KB Output is correct
10 Correct 99 ms 10524 KB Output is correct
11 Correct 89 ms 10216 KB Output is correct
12 Correct 96 ms 10092 KB Output is correct
13 Correct 94 ms 10580 KB Output is correct
14 Correct 94 ms 10396 KB Output is correct
15 Correct 113 ms 10488 KB Output is correct
16 Correct 113 ms 10392 KB Output is correct
17 Correct 84 ms 10172 KB Output is correct
18 Correct 82 ms 10232 KB Output is correct
19 Correct 82 ms 10380 KB Output is correct
20 Correct 79 ms 10360 KB Output is correct
21 Correct 85 ms 10384 KB Output is correct
22 Correct 88 ms 10188 KB Output is correct
23 Correct 83 ms 10360 KB Output is correct
24 Correct 82 ms 10512 KB Output is correct
25 Correct 85 ms 10476 KB Output is correct
26 Correct 83 ms 10184 KB Output is correct
27 Correct 79 ms 10616 KB Output is correct
28 Correct 83 ms 10368 KB Output is correct
29 Correct 88 ms 10244 KB Output is correct
30 Correct 91 ms 10336 KB Output is correct
31 Correct 82 ms 10396 KB Output is correct
32 Correct 91 ms 10616 KB Output is correct
33 Correct 87 ms 10228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 10396 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 79 ms 10348 KB Output is correct
2 Correct 77 ms 10360 KB Output is correct
3 Correct 82 ms 10356 KB Output is correct
4 Correct 79 ms 10232 KB Output is correct
5 Correct 81 ms 10600 KB Output is correct
6 Correct 82 ms 10380 KB Output is correct
7 Correct 81 ms 10368 KB Output is correct
8 Correct 79 ms 10344 KB Output is correct
9 Correct 79 ms 10216 KB Output is correct
10 Correct 83 ms 10428 KB Output is correct
11 Correct 82 ms 10140 KB Output is correct
12 Correct 91 ms 10248 KB Output is correct
13 Correct 83 ms 10636 KB Output is correct
14 Correct 82 ms 10276 KB Output is correct
15 Correct 80 ms 10256 KB Output is correct
16 Correct 79 ms 10432 KB Output is correct
17 Correct 92 ms 10184 KB Output is correct
18 Correct 84 ms 10228 KB Output is correct
19 Correct 94 ms 10308 KB Output is correct
20 Correct 83 ms 10368 KB Output is correct
21 Correct 93 ms 10344 KB Output is correct
22 Correct 96 ms 10332 KB Output is correct
23 Correct 95 ms 10252 KB Output is correct
24 Correct 110 ms 11488 KB Output is correct
25 Correct 101 ms 11280 KB Output is correct
26 Correct 108 ms 10368 KB Output is correct
27 Correct 96 ms 10400 KB Output is correct
28 Incorrect 91 ms 10380 KB on inputs (3, 13), (11, 6), expected 1, but computed 0
29 Halted 0 ms 0 KB -