Submission #143090

# Submission time Handle Problem Language Result Execution time Memory
143090 2019-08-13T01:15:37 Z model_code Vision Program (IOI19_vision) Java 11
44 / 100
176 ms 14872 KB
// incorrect/vision-dm-n2_n2.java
public class vision {

    private int AND(int A, int B)
    {
        int[] gates = {A, B};
        return grader.add_and(gates);
    }

    private int OR(int A, int B)
    {
        int[] gates = {A, B};
        return grader.add_or(gates);
    }

    private int[] diagonal(int H, int W, int N, boolean D)
    {
        int first, last, step;
        if (D)
        {
            first = N < W ? N : W * (N - W + 2) - 1;
            last = N < H ? N * W : (H - 1) * W + (N - H + 1);
            step = W - 1;
        }
        else
        {
            first = N < W ? W - 1 - N : W * (N - W + 1);
            last = N < H ? (N + 1) * W - 1 : H * W + (H - 2 - N);
            step = W + 1;
        }
        int[] cells = new int[(last == first ? 0 : (last - first) / step) + 1];
        int cur = first;
        int cnt = 0;
        while (true)
        {
            cells[cnt] = cur;
            if (cur == last)
            {
                break;
            }
            cnt++;
            cur += step;
        }
        return cells;
    }

    private int bottom_right_position(int H, int W)
    {
        int[] lastRow = new int[W];
        int[] conditions = new int[H * W - 1];
        int conditionsCount = 0;
        for (int y = 0; y < H; y++)
        {
            for (int x = 0; x < W; x++)
            {
                int[] gates = new int[(x > 0 ? 1 : 0) + (y > 0 ? 1 : 0)];
                int gatesCount = 0;
                if (x > 0)
                {
                    gates[gatesCount] = lastRow[x - 1];
                    gatesCount++;
                }
                if (y > 0)
                {
                    gates[gatesCount] = lastRow[x];
                }
                int gate = W * y + x;
                if (gates.length > 0)
                {
                    conditions[conditionsCount] = AND(gate, grader.add_or(gates));
                    conditionsCount++;
                }
                int[] allGates = new int[gates.length + 1];
                System.arraycopy(gates, 0, allGates, 0, gates.length);
                allGates[gates.length] = gate;
                lastRow[x] = grader.add_or(allGates);
            }
        }
        return grader.add_or(conditions);
    }

    public void construct_network(int H, int W, int K)
    {
        int pairs = H + W - 1 - K;
        int[] topRight = new int[pairs];
        int[] topLeft = new int[pairs];
        for (int i = 0; i < pairs; i++)
        {
            topRight[i] = AND(grader.add_or(diagonal(H, W, i, true)), grader.add_or(diagonal(H, W, i + K, true)));
            topLeft[i] = AND(grader.add_or(diagonal(H, W, i, false)), grader.add_or(diagonal(H, W, i + K, false)));
        }
        int bottomRightPosition = bottom_right_position(H, W);
        OR(
            AND(grader.add_or(topRight), bottomRightPosition),
            AND(grader.add_or(topLeft), grader.add_not(bottomRightPosition))
        );
    }
}
# Verdict Execution time Memory Grader output
1 Correct 84 ms 9644 KB Output is correct
2 Correct 90 ms 9592 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 101 ms 9588 KB Output is correct
5 Correct 97 ms 9632 KB Output is correct
6 Correct 97 ms 9628 KB Output is correct
7 Correct 89 ms 9536 KB Output is correct
8 Correct 95 ms 9760 KB Output is correct
9 Correct 91 ms 9472 KB Output is correct
10 Correct 95 ms 9700 KB Output is correct
11 Correct 100 ms 9632 KB Output is correct
12 Correct 87 ms 9816 KB Output is correct
13 Correct 88 ms 9636 KB Output is correct
14 Correct 89 ms 9672 KB Output is correct
15 Correct 86 ms 9496 KB Output is correct
16 Correct 85 ms 9580 KB Output is correct
17 Correct 86 ms 9756 KB Output is correct
18 Correct 85 ms 9520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 9644 KB Output is correct
2 Correct 90 ms 9592 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 101 ms 9588 KB Output is correct
5 Correct 97 ms 9632 KB Output is correct
6 Correct 97 ms 9628 KB Output is correct
7 Correct 89 ms 9536 KB Output is correct
8 Correct 95 ms 9760 KB Output is correct
9 Correct 91 ms 9472 KB Output is correct
10 Correct 95 ms 9700 KB Output is correct
11 Correct 100 ms 9632 KB Output is correct
12 Correct 87 ms 9816 KB Output is correct
13 Correct 88 ms 9636 KB Output is correct
14 Correct 89 ms 9672 KB Output is correct
15 Correct 86 ms 9496 KB Output is correct
16 Correct 85 ms 9580 KB Output is correct
17 Correct 86 ms 9756 KB Output is correct
18 Correct 85 ms 9520 KB Output is correct
19 Correct 87 ms 9824 KB Output is correct
20 Correct 95 ms 9660 KB Output is correct
21 Correct 88 ms 9616 KB Output is correct
22 Correct 88 ms 9720 KB Output is correct
23 Correct 93 ms 9952 KB Output is correct
24 Correct 94 ms 9760 KB Output is correct
25 Correct 94 ms 9908 KB Output is correct
26 Correct 93 ms 9712 KB Output is correct
27 Correct 97 ms 9672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 9644 KB Output is correct
2 Correct 90 ms 9592 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 101 ms 9588 KB Output is correct
5 Correct 97 ms 9632 KB Output is correct
6 Correct 97 ms 9628 KB Output is correct
7 Correct 89 ms 9536 KB Output is correct
8 Correct 95 ms 9760 KB Output is correct
9 Correct 91 ms 9472 KB Output is correct
10 Correct 95 ms 9700 KB Output is correct
11 Correct 100 ms 9632 KB Output is correct
12 Correct 87 ms 9816 KB Output is correct
13 Correct 88 ms 9636 KB Output is correct
14 Correct 89 ms 9672 KB Output is correct
15 Correct 86 ms 9496 KB Output is correct
16 Correct 85 ms 9580 KB Output is correct
17 Correct 86 ms 9756 KB Output is correct
18 Correct 85 ms 9520 KB Output is correct
19 Correct 87 ms 9824 KB Output is correct
20 Correct 95 ms 9660 KB Output is correct
21 Correct 88 ms 9616 KB Output is correct
22 Correct 88 ms 9720 KB Output is correct
23 Correct 93 ms 9952 KB Output is correct
24 Correct 94 ms 9760 KB Output is correct
25 Correct 94 ms 9908 KB Output is correct
26 Correct 93 ms 9712 KB Output is correct
27 Correct 97 ms 9672 KB Output is correct
28 Correct 120 ms 11036 KB Output is correct
29 Correct 139 ms 9836 KB Output is correct
30 Correct 91 ms 9712 KB Output is correct
31 Correct 103 ms 10268 KB Output is correct
32 Correct 106 ms 10868 KB Output is correct
33 Correct 119 ms 11928 KB Output is correct
34 Correct 112 ms 11168 KB Output is correct
35 Correct 122 ms 12028 KB Output is correct
36 Correct 113 ms 11512 KB Output is correct
37 Correct 114 ms 11372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 9644 KB Output is correct
2 Correct 90 ms 9592 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 101 ms 9588 KB Output is correct
5 Correct 97 ms 9632 KB Output is correct
6 Correct 97 ms 9628 KB Output is correct
7 Correct 89 ms 9536 KB Output is correct
8 Correct 95 ms 9760 KB Output is correct
9 Correct 91 ms 9472 KB Output is correct
10 Correct 95 ms 9700 KB Output is correct
11 Correct 100 ms 9632 KB Output is correct
12 Correct 87 ms 9816 KB Output is correct
13 Correct 88 ms 9636 KB Output is correct
14 Correct 89 ms 9672 KB Output is correct
15 Correct 86 ms 9496 KB Output is correct
16 Correct 85 ms 9580 KB Output is correct
17 Correct 86 ms 9756 KB Output is correct
18 Correct 85 ms 9520 KB Output is correct
19 Correct 87 ms 9824 KB Output is correct
20 Correct 95 ms 9660 KB Output is correct
21 Correct 88 ms 9616 KB Output is correct
22 Correct 88 ms 9720 KB Output is correct
23 Correct 93 ms 9952 KB Output is correct
24 Correct 94 ms 9760 KB Output is correct
25 Correct 94 ms 9908 KB Output is correct
26 Correct 93 ms 9712 KB Output is correct
27 Correct 97 ms 9672 KB Output is correct
28 Correct 120 ms 11036 KB Output is correct
29 Correct 139 ms 9836 KB Output is correct
30 Correct 91 ms 9712 KB Output is correct
31 Correct 103 ms 10268 KB Output is correct
32 Correct 106 ms 10868 KB Output is correct
33 Correct 119 ms 11928 KB Output is correct
34 Correct 112 ms 11168 KB Output is correct
35 Correct 122 ms 12028 KB Output is correct
36 Correct 113 ms 11512 KB Output is correct
37 Correct 114 ms 11372 KB Output is correct
38 Incorrect 113 ms 12288 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 109 ms 11008 KB Output is correct
2 Correct 97 ms 10076 KB Output is correct
3 Correct 105 ms 10124 KB Output is correct
4 Correct 96 ms 9992 KB Output is correct
5 Correct 126 ms 11180 KB Output is correct
6 Correct 99 ms 10112 KB Output is correct
7 Correct 95 ms 9996 KB Output is correct
8 Correct 92 ms 10088 KB Output is correct
9 Correct 101 ms 10268 KB Output is correct
10 Correct 96 ms 9920 KB Output is correct
11 Correct 97 ms 9956 KB Output is correct
12 Correct 98 ms 9928 KB Output is correct
13 Correct 96 ms 10008 KB Output is correct
14 Correct 98 ms 10060 KB Output is correct
15 Correct 102 ms 10292 KB Output is correct
16 Correct 103 ms 10108 KB Output is correct
17 Correct 98 ms 10204 KB Output is correct
18 Correct 98 ms 10120 KB Output is correct
19 Correct 95 ms 10000 KB Output is correct
20 Correct 100 ms 9868 KB Output is correct
21 Correct 84 ms 9588 KB Output is correct
22 Correct 90 ms 9584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 9472 KB Output is correct
2 Correct 85 ms 9612 KB Output is correct
3 Correct 176 ms 14084 KB Output is correct
4 Correct 168 ms 14860 KB Output is correct
5 Correct 169 ms 14872 KB Output is correct
6 Correct 162 ms 14156 KB Output is correct
7 Correct 159 ms 14096 KB Output is correct
8 Incorrect 107 ms 11764 KB WA in grader: Too many instructions
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 12908 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 84 ms 9644 KB Output is correct
2 Correct 90 ms 9592 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 101 ms 9588 KB Output is correct
5 Correct 97 ms 9632 KB Output is correct
6 Correct 97 ms 9628 KB Output is correct
7 Correct 89 ms 9536 KB Output is correct
8 Correct 95 ms 9760 KB Output is correct
9 Correct 91 ms 9472 KB Output is correct
10 Correct 95 ms 9700 KB Output is correct
11 Correct 100 ms 9632 KB Output is correct
12 Correct 87 ms 9816 KB Output is correct
13 Correct 88 ms 9636 KB Output is correct
14 Correct 89 ms 9672 KB Output is correct
15 Correct 86 ms 9496 KB Output is correct
16 Correct 85 ms 9580 KB Output is correct
17 Correct 86 ms 9756 KB Output is correct
18 Correct 85 ms 9520 KB Output is correct
19 Correct 87 ms 9824 KB Output is correct
20 Correct 95 ms 9660 KB Output is correct
21 Correct 88 ms 9616 KB Output is correct
22 Correct 88 ms 9720 KB Output is correct
23 Correct 93 ms 9952 KB Output is correct
24 Correct 94 ms 9760 KB Output is correct
25 Correct 94 ms 9908 KB Output is correct
26 Correct 93 ms 9712 KB Output is correct
27 Correct 97 ms 9672 KB Output is correct
28 Correct 120 ms 11036 KB Output is correct
29 Correct 139 ms 9836 KB Output is correct
30 Correct 91 ms 9712 KB Output is correct
31 Correct 103 ms 10268 KB Output is correct
32 Correct 106 ms 10868 KB Output is correct
33 Correct 119 ms 11928 KB Output is correct
34 Correct 112 ms 11168 KB Output is correct
35 Correct 122 ms 12028 KB Output is correct
36 Correct 113 ms 11512 KB Output is correct
37 Correct 114 ms 11372 KB Output is correct
38 Incorrect 113 ms 12288 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -