Submission #602822

# Submission time Handle Problem Language Result Execution time Memory
602822 2022-07-23T11:38:14 Z Johann Vision Program (IOI19_vision) C++14
100 / 100
49 ms 5960 KB
#include "vision.h"

using namespace std;

typedef vector<int> vi;
#define sz(x) (int)(x).size()

int h, w, k;

struct diag {
    int D;
    vi P;
    int OR;
    int TWO;
};

int calc_pos(int x, int y) {
    return y * w + x;
}

int check_auf_zwei_Punkte(vi &q, int pos_or) {
    return add_and({pos_or, add_not(add_xor(q))});
}

int check_diag(vector<diag> &D, int i, int K) {
    vi qor;
    for (int j = 0; j < K; ++j) {
        qor.push_back(D[i + j].OR);
    }
    return add_and({add_or(qor), add_not(add_xor(qor))});
}

void construct_network(int H, int W, int K) {
    h = H;
    w = W;
    k = K;
    // Rechte Diagonalen (x - y = konst)
    vector<diag> R;
    for (int d = -H + 1; d < W; ++d) {
        R.push_back(diag());
        R.back().D = d;
        for (int x = 0; x < W; ++x) {
            int y = x - d;
            if (0 <= y && y < H) {
                R.back().P.push_back(calc_pos(x, y));
            }
        }
        R.back().OR = add_or(R.back().P);
        R.back().TWO = check_auf_zwei_Punkte(R.back().P, R.back().OR);
    }
    // Linke Diagonale (x + y = konst)
    vector<diag> L;
    for (int d = 0; d <= H + W - 2; ++d) {
        L.push_back(diag());
        L.back().D = d;
        for (int x = 0; x < W; ++x) {
            int y = d - x;
            if (0 <= y && y < H) {
                L.back().P.push_back(calc_pos(x, y));
            }
        }
        L.back().OR = add_or(L.back().P);
        L.back().TWO = check_auf_zwei_Punkte(L.back().P, L.back().OR);
    }
    // Blöcke mit Größe K enthält zwei dinger...
    vi RK, LK;
    for (int i = 0; i <= sz(R) - K; ++i) {
        RK.push_back(check_diag(R, i, K));
        LK.push_back(check_diag(L, i, K));
    }
    for (int i = 0; i < sz(R); ++i) {
        RK.push_back(R[i].TWO);
        LK.push_back(L[i].TWO);
    }
    int tRK = add_or(RK);
    int tLK = add_or(LK);
    int kb = add_and({tRK, tLK});
    int nkb = add_not(kb);
    // Blöcke mit K+1 enthält zwei dinger
    vi RK1, LK1;
    for (int i = 0; i <= sz(R) - K - 1; ++i) {
        RK1.push_back(check_diag(R, i, K + 1));
        LK1.push_back(check_diag(L, i, K + 1));
    }
    for (int i = 0; i < sz(R); ++i) {
        RK1.push_back(R[i].TWO);
        LK1.push_back(L[i].TWO);
    }
    int tRK1 = add_or(RK1);
    int tLK1 = add_or(LK1);
    int kb1 = add_and({tRK1, tLK1});

    int ans = add_and({kb1, nkb});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:93:9: warning: unused variable 'ans' [-Wunused-variable]
   93 |     int ans = add_and({kb1, nkb});
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 13 ms 1640 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 6 ms 724 KB Output is correct
42 Correct 3 ms 596 KB Output is correct
43 Correct 6 ms 1104 KB Output is correct
44 Correct 11 ms 1620 KB Output is correct
45 Correct 13 ms 1736 KB Output is correct
46 Correct 10 ms 1492 KB Output is correct
47 Correct 5 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 724 KB Output is correct
2 Correct 12 ms 1180 KB Output is correct
3 Correct 12 ms 1116 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
6 Correct 8 ms 1108 KB Output is correct
7 Correct 9 ms 1092 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 3 ms 724 KB Output is correct
10 Correct 8 ms 1108 KB Output is correct
11 Correct 8 ms 1208 KB Output is correct
12 Correct 9 ms 1236 KB Output is correct
13 Correct 7 ms 980 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 9 ms 1112 KB Output is correct
17 Correct 9 ms 1236 KB Output is correct
18 Correct 11 ms 1236 KB Output is correct
19 Correct 7 ms 980 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 4 ms 596 KB Output is correct
4 Correct 5 ms 852 KB Output is correct
5 Correct 5 ms 832 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 5 ms 852 KB Output is correct
9 Correct 8 ms 1236 KB Output is correct
10 Correct 9 ms 1364 KB Output is correct
11 Correct 12 ms 1088 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 596 KB Output is correct
14 Correct 8 ms 1108 KB Output is correct
15 Correct 8 ms 1108 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 3 ms 724 KB Output is correct
18 Correct 10 ms 1228 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 10 ms 1812 KB Output is correct
21 Correct 24 ms 3192 KB Output is correct
22 Correct 30 ms 3068 KB Output is correct
23 Correct 10 ms 1492 KB Output is correct
24 Correct 11 ms 1744 KB Output is correct
25 Correct 26 ms 3300 KB Output is correct
26 Correct 9 ms 1480 KB Output is correct
27 Correct 21 ms 3012 KB Output is correct
28 Correct 40 ms 5272 KB Output is correct
29 Correct 46 ms 5948 KB Output is correct
30 Correct 39 ms 5024 KB Output is correct
31 Correct 17 ms 2548 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2980 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 5 ms 852 KB Output is correct
5 Correct 3 ms 668 KB Output is correct
6 Correct 4 ms 724 KB Output is correct
7 Correct 15 ms 1816 KB Output is correct
8 Correct 12 ms 1804 KB Output is correct
9 Correct 21 ms 3068 KB Output is correct
10 Correct 1 ms 288 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 13 ms 1640 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 468 KB Output is correct
41 Correct 6 ms 724 KB Output is correct
42 Correct 3 ms 596 KB Output is correct
43 Correct 6 ms 1104 KB Output is correct
44 Correct 11 ms 1620 KB Output is correct
45 Correct 13 ms 1736 KB Output is correct
46 Correct 10 ms 1492 KB Output is correct
47 Correct 5 ms 852 KB Output is correct
48 Correct 3 ms 724 KB Output is correct
49 Correct 12 ms 1180 KB Output is correct
50 Correct 12 ms 1116 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 4 ms 724 KB Output is correct
53 Correct 8 ms 1108 KB Output is correct
54 Correct 9 ms 1092 KB Output is correct
55 Correct 1 ms 468 KB Output is correct
56 Correct 3 ms 724 KB Output is correct
57 Correct 8 ms 1108 KB Output is correct
58 Correct 8 ms 1208 KB Output is correct
59 Correct 9 ms 1236 KB Output is correct
60 Correct 7 ms 980 KB Output is correct
61 Correct 2 ms 340 KB Output is correct
62 Correct 3 ms 724 KB Output is correct
63 Correct 9 ms 1112 KB Output is correct
64 Correct 9 ms 1236 KB Output is correct
65 Correct 11 ms 1236 KB Output is correct
66 Correct 7 ms 980 KB Output is correct
67 Correct 2 ms 340 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 4 ms 596 KB Output is correct
73 Correct 5 ms 852 KB Output is correct
74 Correct 5 ms 832 KB Output is correct
75 Correct 5 ms 724 KB Output is correct
76 Correct 2 ms 468 KB Output is correct
77 Correct 5 ms 852 KB Output is correct
78 Correct 8 ms 1236 KB Output is correct
79 Correct 9 ms 1364 KB Output is correct
80 Correct 12 ms 1088 KB Output is correct
81 Correct 3 ms 596 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 8 ms 1108 KB Output is correct
84 Correct 8 ms 1108 KB Output is correct
85 Correct 2 ms 468 KB Output is correct
86 Correct 3 ms 724 KB Output is correct
87 Correct 10 ms 1228 KB Output is correct
88 Correct 1 ms 468 KB Output is correct
89 Correct 10 ms 1812 KB Output is correct
90 Correct 24 ms 3192 KB Output is correct
91 Correct 30 ms 3068 KB Output is correct
92 Correct 10 ms 1492 KB Output is correct
93 Correct 11 ms 1744 KB Output is correct
94 Correct 26 ms 3300 KB Output is correct
95 Correct 9 ms 1480 KB Output is correct
96 Correct 21 ms 3012 KB Output is correct
97 Correct 40 ms 5272 KB Output is correct
98 Correct 46 ms 5948 KB Output is correct
99 Correct 39 ms 5024 KB Output is correct
100 Correct 17 ms 2548 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 20 ms 2980 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 3 ms 596 KB Output is correct
106 Correct 5 ms 852 KB Output is correct
107 Correct 3 ms 668 KB Output is correct
108 Correct 4 ms 724 KB Output is correct
109 Correct 15 ms 1816 KB Output is correct
110 Correct 12 ms 1804 KB Output is correct
111 Correct 21 ms 3068 KB Output is correct
112 Correct 1 ms 288 KB Output is correct
113 Correct 0 ms 212 KB Output is correct
114 Correct 40 ms 5288 KB Output is correct
115 Correct 2 ms 468 KB Output is correct
116 Correct 3 ms 724 KB Output is correct
117 Correct 23 ms 2492 KB Output is correct
118 Correct 21 ms 2680 KB Output is correct
119 Correct 46 ms 5844 KB Output is correct
120 Correct 46 ms 5832 KB Output is correct
121 Correct 47 ms 5924 KB Output is correct
122 Correct 46 ms 5880 KB Output is correct
123 Correct 21 ms 3040 KB Output is correct
124 Correct 41 ms 5220 KB Output is correct
125 Correct 49 ms 5960 KB Output is correct
126 Correct 47 ms 5908 KB Output is correct
127 Correct 39 ms 5064 KB Output is correct
128 Correct 17 ms 2544 KB Output is correct