답안 #832670

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832670 2023-08-21T13:31:46 Z benjaminkleyn Vision Program (IOI19_vision) C++17
100 / 100
47 ms 5816 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

void construct_network(int h, int w, int k)
{
    vector<vector<int>> idxR(w + h - 1);
    vector<vector<int>> idxL(w + h - 1);
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
        {
            idxR[i + j].push_back(i * w + j);
            idxL[i + w - 1 - j].push_back(i * w + j);
        }

    vector<int> rd1(w + h - 1);
    vector<int> rd2(w + h - 1);
    vector<int> ld1(w + h - 1);
    vector<int> ld2(w + h - 1);
    for (int d = 0; d < w + h - 1; d++)
    {
        rd1[d] = add_or(idxR[d]);
        rd2[d] = add_xor(idxR[d]);

        ld1[d] = add_or(idxL[d]);
        ld2[d] = add_xor(idxL[d]);
    }

    vector<int> A, B;
    for (int d = 0; d + k < w + h - 1; d++)
    {
        vector<int> idxR1, idxR2, idxL1, idxL2;
        for (int i = d; i <= d + k; i++)
        {
            idxR1.push_back(rd1[i]);
            idxR2.push_back(rd2[i]);
            idxL1.push_back(ld1[i]);
            idxL2.push_back(ld2[i]);
        }
        int r1 = add_or(idxR1);
        int r2 = add_xor(idxR2);
        int l1 = add_or(idxL1);
        int l2 = add_xor(idxL2);
        A.push_back(add_and({r1, add_not(r2)}));
        B.push_back(add_and({l1, add_not(l2)}));
    }

    vector<int> C, D;
    for (int d = 0; d + k - 1 < w + h - 1; d++)
    {
        vector<int> idxR1, idxR2, idxL1, idxL2;
        for (int i = d; i <= d + k - 1; i++)
        {
            idxR1.push_back(rd1[i]);
            idxR2.push_back(rd2[i]);
            idxL1.push_back(ld1[i]);
            idxL2.push_back(ld2[i]);
        }
        int r1 = add_or(idxR1);
        int r2 = add_xor(idxR2);
        int l1 = add_or(idxL1);
        int l2 = add_xor(idxL2);
        C.push_back(add_and({r1, add_not(r2)}));
        D.push_back(add_and({l1, add_not(l2)}));
    }
    int x = add_and({add_or(A), add_or(B)});
    int y = add_and({add_or(C), add_or(D)});
    add_and({x, add_not(y)});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 1 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 1 ms 212 KB Output is correct
23 Correct 0 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 1 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 1 ms 212 KB Output is correct
23 Correct 0 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 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 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 1 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 1 ms 212 KB Output is correct
23 Correct 0 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 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 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 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 12 ms 1492 KB Output is correct
39 Correct 3 ms 468 KB Output is correct
40 Correct 2 ms 428 KB Output is correct
41 Correct 3 ms 724 KB Output is correct
42 Correct 2 ms 596 KB Output is correct
43 Correct 5 ms 980 KB Output is correct
44 Correct 12 ms 1528 KB Output is correct
45 Correct 10 ms 1648 KB Output is correct
46 Correct 8 ms 1492 KB Output is correct
47 Correct 4 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 7 ms 1024 KB Output is correct
3 Correct 11 ms 1108 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 8 ms 1028 KB Output is correct
7 Correct 8 ms 980 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 3 ms 596 KB Output is correct
10 Correct 7 ms 980 KB Output is correct
11 Correct 7 ms 1108 KB Output is correct
12 Correct 8 ms 1024 KB Output is correct
13 Correct 5 ms 852 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 596 KB Output is correct
16 Correct 6 ms 1028 KB Output is correct
17 Correct 7 ms 1108 KB Output is correct
18 Correct 7 ms 1032 KB Output is correct
19 Correct 7 ms 852 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 4 ms 852 KB Output is correct
5 Correct 4 ms 808 KB Output is correct
6 Correct 4 ms 724 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 3 ms 852 KB Output is correct
9 Correct 7 ms 1108 KB Output is correct
10 Correct 8 ms 1328 KB Output is correct
11 Correct 6 ms 1064 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 2 ms 596 KB Output is correct
14 Correct 6 ms 980 KB Output is correct
15 Correct 6 ms 980 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 7 ms 1108 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 8 ms 1744 KB Output is correct
21 Correct 20 ms 3148 KB Output is correct
22 Correct 23 ms 3048 KB Output is correct
23 Correct 9 ms 1364 KB Output is correct
24 Correct 13 ms 1636 KB Output is correct
25 Correct 27 ms 3276 KB Output is correct
26 Correct 7 ms 1364 KB Output is correct
27 Correct 15 ms 2924 KB Output is correct
28 Correct 38 ms 5124 KB Output is correct
29 Correct 47 ms 5808 KB Output is correct
30 Correct 32 ms 4892 KB Output is correct
31 Correct 13 ms 2408 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 2944 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 4 ms 852 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 8 ms 1744 KB Output is correct
8 Correct 11 ms 1676 KB Output is correct
9 Correct 16 ms 2864 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 1 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 1 ms 212 KB Output is correct
23 Correct 0 ms 340 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 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 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 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 12 ms 1492 KB Output is correct
39 Correct 3 ms 468 KB Output is correct
40 Correct 2 ms 428 KB Output is correct
41 Correct 3 ms 724 KB Output is correct
42 Correct 2 ms 596 KB Output is correct
43 Correct 5 ms 980 KB Output is correct
44 Correct 12 ms 1528 KB Output is correct
45 Correct 10 ms 1648 KB Output is correct
46 Correct 8 ms 1492 KB Output is correct
47 Correct 4 ms 852 KB Output is correct
48 Correct 2 ms 596 KB Output is correct
49 Correct 7 ms 1024 KB Output is correct
50 Correct 11 ms 1108 KB Output is correct
51 Correct 1 ms 340 KB Output is correct
52 Correct 2 ms 596 KB Output is correct
53 Correct 8 ms 1028 KB Output is correct
54 Correct 8 ms 980 KB Output is correct
55 Correct 1 ms 340 KB Output is correct
56 Correct 3 ms 596 KB Output is correct
57 Correct 7 ms 980 KB Output is correct
58 Correct 7 ms 1108 KB Output is correct
59 Correct 8 ms 1024 KB Output is correct
60 Correct 5 ms 852 KB Output is correct
61 Correct 1 ms 340 KB Output is correct
62 Correct 2 ms 596 KB Output is correct
63 Correct 6 ms 1028 KB Output is correct
64 Correct 7 ms 1108 KB Output is correct
65 Correct 7 ms 1032 KB Output is correct
66 Correct 7 ms 852 KB Output is correct
67 Correct 1 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 2 ms 596 KB Output is correct
73 Correct 4 ms 852 KB Output is correct
74 Correct 4 ms 808 KB Output is correct
75 Correct 4 ms 724 KB Output is correct
76 Correct 2 ms 468 KB Output is correct
77 Correct 3 ms 852 KB Output is correct
78 Correct 7 ms 1108 KB Output is correct
79 Correct 8 ms 1328 KB Output is correct
80 Correct 6 ms 1064 KB Output is correct
81 Correct 3 ms 596 KB Output is correct
82 Correct 2 ms 596 KB Output is correct
83 Correct 6 ms 980 KB Output is correct
84 Correct 6 ms 980 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 2 ms 596 KB Output is correct
87 Correct 7 ms 1108 KB Output is correct
88 Correct 1 ms 340 KB Output is correct
89 Correct 8 ms 1744 KB Output is correct
90 Correct 20 ms 3148 KB Output is correct
91 Correct 23 ms 3048 KB Output is correct
92 Correct 9 ms 1364 KB Output is correct
93 Correct 13 ms 1636 KB Output is correct
94 Correct 27 ms 3276 KB Output is correct
95 Correct 7 ms 1364 KB Output is correct
96 Correct 15 ms 2924 KB Output is correct
97 Correct 38 ms 5124 KB Output is correct
98 Correct 47 ms 5808 KB Output is correct
99 Correct 32 ms 4892 KB Output is correct
100 Correct 13 ms 2408 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 15 ms 2944 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 2 ms 596 KB Output is correct
106 Correct 4 ms 852 KB Output is correct
107 Correct 2 ms 596 KB Output is correct
108 Correct 2 ms 596 KB Output is correct
109 Correct 8 ms 1744 KB Output is correct
110 Correct 11 ms 1676 KB Output is correct
111 Correct 16 ms 2864 KB Output is correct
112 Correct 0 ms 212 KB Output is correct
113 Correct 0 ms 212 KB Output is correct
114 Correct 33 ms 5064 KB Output is correct
115 Correct 1 ms 340 KB Output is correct
116 Correct 2 ms 596 KB Output is correct
117 Correct 14 ms 2312 KB Output is correct
118 Correct 21 ms 2608 KB Output is correct
119 Correct 41 ms 5740 KB Output is correct
120 Correct 46 ms 5724 KB Output is correct
121 Correct 39 ms 5788 KB Output is correct
122 Correct 38 ms 5796 KB Output is correct
123 Correct 15 ms 2896 KB Output is correct
124 Correct 39 ms 5052 KB Output is correct
125 Correct 38 ms 5720 KB Output is correct
126 Correct 39 ms 5816 KB Output is correct
127 Correct 31 ms 4912 KB Output is correct
128 Correct 13 ms 2388 KB Output is correct