Submission #602715

# Submission time Handle Problem Language Result Execution time Memory
602715 2022-07-23T10:36:20 Z Johann Vision Program (IOI19_vision) C++14
59 / 100
35 ms 4240 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, qtwo;
    for (int j = 0; j < K; ++j) {
        qor.push_back(D[i + j].OR);
        qtwo.push_back(D[i + j].TWO);
    }
    qtwo.push_back(add_and({add_or(qor), add_not(add_xor(qor))}));
    return add_or(qtwo);
}

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));
    }
    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));
    }
    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:86:9: warning: unused variable 'ans' [-Wunused-variable]
   86 |     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 1 ms 212 KB Output is correct
4 Correct 1 ms 288 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 292 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 288 KB Output is correct
11 Correct 0 ms 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 288 KB Output is correct
18 Correct 0 ms 284 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 1 ms 212 KB Output is correct
4 Correct 1 ms 288 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 292 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 288 KB Output is correct
11 Correct 0 ms 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 288 KB Output is correct
18 Correct 0 ms 284 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 232 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 340 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 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 1 ms 212 KB Output is correct
4 Correct 1 ms 288 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 292 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 288 KB Output is correct
11 Correct 0 ms 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 288 KB Output is correct
18 Correct 0 ms 284 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 232 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 340 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 412 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 356 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 412 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 2 ms 468 KB Output is correct
36 Correct 2 ms 416 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 1 ms 212 KB Output is correct
4 Correct 1 ms 288 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 292 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 288 KB Output is correct
11 Correct 0 ms 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 288 KB Output is correct
18 Correct 0 ms 284 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 232 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 340 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 412 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 356 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 412 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 2 ms 468 KB Output is correct
36 Correct 2 ms 416 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 14 ms 2004 KB Output is correct
39 Correct 3 ms 596 KB Output is correct
40 Correct 3 ms 468 KB Output is correct
41 Correct 6 ms 852 KB Output is correct
42 Correct 3 ms 596 KB Output is correct
43 Correct 7 ms 1128 KB Output is correct
44 Correct 14 ms 1992 KB Output is correct
45 Correct 18 ms 2204 KB Output is correct
46 Correct 20 ms 1748 KB Output is correct
47 Correct 6 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 720 KB Output is correct
2 Correct 12 ms 1580 KB Output is correct
3 Correct 12 ms 1492 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 3 ms 720 KB Output is correct
6 Correct 13 ms 1488 KB Output is correct
7 Correct 12 ms 1320 KB Output is correct
8 Correct 2 ms 416 KB Output is correct
9 Correct 4 ms 668 KB Output is correct
10 Correct 11 ms 1360 KB Output is correct
11 Correct 13 ms 1608 KB Output is correct
12 Correct 13 ms 1492 KB Output is correct
13 Correct 10 ms 1184 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 3 ms 724 KB Output is correct
16 Correct 11 ms 1324 KB Output is correct
17 Correct 12 ms 1524 KB Output is correct
18 Correct 12 ms 1492 KB Output is correct
19 Correct 10 ms 1180 KB Output is correct
20 Correct 1 ms 412 KB Output is correct
21 Correct 0 ms 288 KB Output is correct
22 Correct 0 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 284 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 724 KB Output is correct
4 Correct 6 ms 980 KB Output is correct
5 Correct 9 ms 980 KB Output is correct
6 Correct 6 ms 852 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 5 ms 852 KB Output is correct
9 Correct 11 ms 1460 KB Output is correct
10 Correct 12 ms 1636 KB Output is correct
11 Correct 10 ms 1308 KB Output is correct
12 Correct 3 ms 628 KB Output is correct
13 Correct 5 ms 724 KB Output is correct
14 Correct 12 ms 1444 KB Output is correct
15 Correct 11 ms 1400 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 3 ms 720 KB Output is correct
18 Correct 12 ms 1492 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 12 ms 1880 KB Output is correct
21 Correct 32 ms 4020 KB Output is correct
22 Correct 31 ms 3928 KB Output is correct
23 Correct 12 ms 1492 KB Output is correct
24 Correct 11 ms 1868 KB Output is correct
25 Correct 35 ms 4240 KB Output is correct
26 Correct 9 ms 1492 KB Output is correct
27 Incorrect 3 ms 2128 KB WA in grader: Too many instructions
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2128 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 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 1 ms 212 KB Output is correct
4 Correct 1 ms 288 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 292 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 288 KB Output is correct
11 Correct 0 ms 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 288 KB Output is correct
18 Correct 0 ms 284 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 232 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 340 KB Output is correct
24 Correct 1 ms 292 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 412 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 356 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 412 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 2 ms 468 KB Output is correct
36 Correct 2 ms 416 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 14 ms 2004 KB Output is correct
39 Correct 3 ms 596 KB Output is correct
40 Correct 3 ms 468 KB Output is correct
41 Correct 6 ms 852 KB Output is correct
42 Correct 3 ms 596 KB Output is correct
43 Correct 7 ms 1128 KB Output is correct
44 Correct 14 ms 1992 KB Output is correct
45 Correct 18 ms 2204 KB Output is correct
46 Correct 20 ms 1748 KB Output is correct
47 Correct 6 ms 852 KB Output is correct
48 Correct 3 ms 720 KB Output is correct
49 Correct 12 ms 1580 KB Output is correct
50 Correct 12 ms 1492 KB Output is correct
51 Correct 1 ms 468 KB Output is correct
52 Correct 3 ms 720 KB Output is correct
53 Correct 13 ms 1488 KB Output is correct
54 Correct 12 ms 1320 KB Output is correct
55 Correct 2 ms 416 KB Output is correct
56 Correct 4 ms 668 KB Output is correct
57 Correct 11 ms 1360 KB Output is correct
58 Correct 13 ms 1608 KB Output is correct
59 Correct 13 ms 1492 KB Output is correct
60 Correct 10 ms 1184 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 3 ms 724 KB Output is correct
63 Correct 11 ms 1324 KB Output is correct
64 Correct 12 ms 1524 KB Output is correct
65 Correct 12 ms 1492 KB Output is correct
66 Correct 10 ms 1180 KB Output is correct
67 Correct 1 ms 412 KB Output is correct
68 Correct 0 ms 288 KB Output is correct
69 Correct 0 ms 288 KB Output is correct
70 Correct 0 ms 284 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 3 ms 724 KB Output is correct
73 Correct 6 ms 980 KB Output is correct
74 Correct 9 ms 980 KB Output is correct
75 Correct 6 ms 852 KB Output is correct
76 Correct 3 ms 468 KB Output is correct
77 Correct 5 ms 852 KB Output is correct
78 Correct 11 ms 1460 KB Output is correct
79 Correct 12 ms 1636 KB Output is correct
80 Correct 10 ms 1308 KB Output is correct
81 Correct 3 ms 628 KB Output is correct
82 Correct 5 ms 724 KB Output is correct
83 Correct 12 ms 1444 KB Output is correct
84 Correct 11 ms 1400 KB Output is correct
85 Correct 2 ms 468 KB Output is correct
86 Correct 3 ms 720 KB Output is correct
87 Correct 12 ms 1492 KB Output is correct
88 Correct 1 ms 468 KB Output is correct
89 Correct 12 ms 1880 KB Output is correct
90 Correct 32 ms 4020 KB Output is correct
91 Correct 31 ms 3928 KB Output is correct
92 Correct 12 ms 1492 KB Output is correct
93 Correct 11 ms 1868 KB Output is correct
94 Correct 35 ms 4240 KB Output is correct
95 Correct 9 ms 1492 KB Output is correct
96 Incorrect 3 ms 2128 KB WA in grader: Too many instructions
97 Halted 0 ms 0 KB -