Submission #721544

# Submission time Handle Problem Language Result Execution time Memory
721544 2023-04-11T04:05:20 Z nguyentunglam Vision Program (IOI19_vision) C++17
100 / 100
42 ms 4336 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 400 + 10;
int a[N][N], row[N], col[N], rowx[N], colx[N];
void construct_network(int h, int w, int k) {
    int n = 0, m = 0;
    for(int i = 0; i <= 400; i++) for(int j = 0; j <= 400; j++) a[i][j] = -1;
    for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) {
        a[i - j + w - 1][i + j] = i * w + j;
        n = max(n, i - j + w - 1);
        m = max(m, i + j);
    }
    n++; m++;
//    for(int i = 0; i < n; i++) {
//        for(int j = 0; j < m; j++) cout << a[i][j] << " ";
//        cout << endl;
//    }

    for(int i = 0; i < n; i++) {
        vector<int> ask;
        for(int j = 0; j < m; j++) if (a[i][j] != -1) ask.push_back(a[i][j]);
        row[i] = add_or(ask);
        rowx[i] = add_xor(ask);
    }

    for(int j = 0; j < m; j++) {
        vector<int> ask;
        for(int i = 0; i < n; i++) if (a[i][j] != -1) {
            ask.push_back(a[i][j]);
        }
        col[j] = add_or(ask);
        colx[j] = add_xor(ask);
    }

    vector<int> lst, R, C;

    for(int i = k; i < n; i++) R.push_back(add_and({row[i], row[i - k]}));
    for(int j = k; j < m; j++) {
        vector<int> ask1, ask2;
        for(int l = j; l >= j - k; l--) {
            ask1.push_back(col[l]);
            ask2.push_back(colx[l]);
        }
        int tmp1 = add_or(ask1);
        int tmp2 = add_not(add_xor(ask2));
        C.push_back(add_and({tmp1, tmp2}));
    }

    if (!R.empty() && !C.empty()) {
        int p1 = add_or(R);
        int p2 = add_or(C);
        lst.push_back(add_and({p1, p2}));
    }

    R.clear(); C.clear();

    for(int j = k; j < m; j++) C.push_back(add_and({col[j], col[j - k]}));
    for(int i = k; i < n; i++) {
        vector<int> ask1, ask2;
        for(int l = i; l >= i - k; l--) {
            ask1.push_back(row[l]);
            ask2.push_back(rowx[l]);
        }
        int tmp1 = add_or(ask1);
        int tmp2 = add_not(add_xor(ask2));
        R.push_back(add_and({tmp1, tmp2}));
    }

    if (!R.empty() && !C.empty()) {
        int p1 = add_or(R);
        int p2 = add_or(C);
        lst.push_back(add_and({p1, p2}));
    }

    int res = add_or(lst);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:76:9: warning: unused variable 'res' [-Wunused-variable]
   76 |     int res = add_or(lst);
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 948 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 1 ms 952 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
12 Correct 1 ms 948 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 1 ms 852 KB Output is correct
15 Correct 1 ms 864 KB Output is correct
16 Correct 1 ms 852 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 948 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 1 ms 952 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
12 Correct 1 ms 948 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 1 ms 852 KB Output is correct
15 Correct 1 ms 864 KB Output is correct
16 Correct 1 ms 852 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 1 ms 944 KB Output is correct
22 Correct 1 ms 852 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 2 ms 948 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 1 ms 980 KB Output is correct
27 Correct 1 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 948 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 1 ms 952 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
12 Correct 1 ms 948 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 1 ms 852 KB Output is correct
15 Correct 1 ms 864 KB Output is correct
16 Correct 1 ms 852 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 1 ms 944 KB Output is correct
22 Correct 1 ms 852 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 2 ms 948 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 1 ms 980 KB Output is correct
27 Correct 1 ms 852 KB Output is correct
28 Correct 2 ms 980 KB Output is correct
29 Correct 1 ms 980 KB Output is correct
30 Correct 1 ms 940 KB Output is correct
31 Correct 1 ms 980 KB Output is correct
32 Correct 2 ms 948 KB Output is correct
33 Correct 2 ms 980 KB Output is correct
34 Correct 2 ms 980 KB Output is correct
35 Correct 2 ms 980 KB Output is correct
36 Correct 2 ms 944 KB Output is correct
37 Correct 1 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 948 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 1 ms 952 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
12 Correct 1 ms 948 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 1 ms 852 KB Output is correct
15 Correct 1 ms 864 KB Output is correct
16 Correct 1 ms 852 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 1 ms 944 KB Output is correct
22 Correct 1 ms 852 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 2 ms 948 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 1 ms 980 KB Output is correct
27 Correct 1 ms 852 KB Output is correct
28 Correct 2 ms 980 KB Output is correct
29 Correct 1 ms 980 KB Output is correct
30 Correct 1 ms 940 KB Output is correct
31 Correct 1 ms 980 KB Output is correct
32 Correct 2 ms 948 KB Output is correct
33 Correct 2 ms 980 KB Output is correct
34 Correct 2 ms 980 KB Output is correct
35 Correct 2 ms 980 KB Output is correct
36 Correct 2 ms 944 KB Output is correct
37 Correct 1 ms 980 KB Output is correct
38 Correct 9 ms 1748 KB Output is correct
39 Correct 2 ms 1108 KB Output is correct
40 Correct 2 ms 980 KB Output is correct
41 Correct 7 ms 1332 KB Output is correct
42 Correct 3 ms 1108 KB Output is correct
43 Correct 7 ms 1492 KB Output is correct
44 Correct 9 ms 1748 KB Output is correct
45 Correct 14 ms 1788 KB Output is correct
46 Correct 9 ms 1620 KB Output is correct
47 Correct 5 ms 1332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1108 KB Output is correct
2 Correct 5 ms 1364 KB Output is correct
3 Correct 6 ms 1392 KB Output is correct
4 Correct 1 ms 980 KB Output is correct
5 Correct 3 ms 1108 KB Output is correct
6 Correct 8 ms 1368 KB Output is correct
7 Correct 5 ms 1304 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 4 ms 1236 KB Output is correct
10 Correct 5 ms 1364 KB Output is correct
11 Correct 5 ms 1364 KB Output is correct
12 Correct 5 ms 1364 KB Output is correct
13 Correct 4 ms 1236 KB Output is correct
14 Correct 1 ms 980 KB Output is correct
15 Correct 2 ms 1108 KB Output is correct
16 Correct 4 ms 1324 KB Output is correct
17 Correct 5 ms 1356 KB Output is correct
18 Correct 5 ms 1348 KB Output is correct
19 Correct 4 ms 1236 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 852 KB Output is correct
22 Correct 1 ms 880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 3 ms 1148 KB Output is correct
4 Correct 4 ms 1236 KB Output is correct
5 Correct 4 ms 1236 KB Output is correct
6 Correct 3 ms 1108 KB Output is correct
7 Correct 2 ms 1108 KB Output is correct
8 Correct 4 ms 1328 KB Output is correct
9 Correct 7 ms 1492 KB Output is correct
10 Correct 8 ms 1492 KB Output is correct
11 Correct 10 ms 1364 KB Output is correct
12 Correct 4 ms 1108 KB Output is correct
13 Correct 3 ms 1108 KB Output is correct
14 Correct 5 ms 1364 KB Output is correct
15 Correct 4 ms 1236 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 2 ms 1204 KB Output is correct
18 Correct 5 ms 1364 KB Output is correct
19 Correct 1 ms 980 KB Output is correct
20 Correct 14 ms 1964 KB Output is correct
21 Correct 17 ms 2644 KB Output is correct
22 Correct 15 ms 2632 KB Output is correct
23 Correct 9 ms 1748 KB Output is correct
24 Correct 10 ms 2000 KB Output is correct
25 Correct 18 ms 2700 KB Output is correct
26 Correct 8 ms 1736 KB Output is correct
27 Correct 18 ms 2928 KB Output is correct
28 Correct 27 ms 3944 KB Output is correct
29 Correct 31 ms 4336 KB Output is correct
30 Correct 28 ms 3868 KB Output is correct
31 Correct 18 ms 2560 KB Output is correct
32 Correct 1 ms 852 KB Output is correct
33 Correct 1 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 2896 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 3 ms 1108 KB Output is correct
4 Correct 5 ms 1364 KB Output is correct
5 Correct 3 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 9 ms 1980 KB Output is correct
8 Correct 10 ms 2000 KB Output is correct
9 Correct 19 ms 2912 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 948 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 852 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 1 ms 952 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
12 Correct 1 ms 948 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 1 ms 852 KB Output is correct
15 Correct 1 ms 864 KB Output is correct
16 Correct 1 ms 852 KB Output is correct
17 Correct 1 ms 852 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 852 KB Output is correct
21 Correct 1 ms 944 KB Output is correct
22 Correct 1 ms 852 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 2 ms 948 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 1 ms 980 KB Output is correct
27 Correct 1 ms 852 KB Output is correct
28 Correct 2 ms 980 KB Output is correct
29 Correct 1 ms 980 KB Output is correct
30 Correct 1 ms 940 KB Output is correct
31 Correct 1 ms 980 KB Output is correct
32 Correct 2 ms 948 KB Output is correct
33 Correct 2 ms 980 KB Output is correct
34 Correct 2 ms 980 KB Output is correct
35 Correct 2 ms 980 KB Output is correct
36 Correct 2 ms 944 KB Output is correct
37 Correct 1 ms 980 KB Output is correct
38 Correct 9 ms 1748 KB Output is correct
39 Correct 2 ms 1108 KB Output is correct
40 Correct 2 ms 980 KB Output is correct
41 Correct 7 ms 1332 KB Output is correct
42 Correct 3 ms 1108 KB Output is correct
43 Correct 7 ms 1492 KB Output is correct
44 Correct 9 ms 1748 KB Output is correct
45 Correct 14 ms 1788 KB Output is correct
46 Correct 9 ms 1620 KB Output is correct
47 Correct 5 ms 1332 KB Output is correct
48 Correct 3 ms 1108 KB Output is correct
49 Correct 5 ms 1364 KB Output is correct
50 Correct 6 ms 1392 KB Output is correct
51 Correct 1 ms 980 KB Output is correct
52 Correct 3 ms 1108 KB Output is correct
53 Correct 8 ms 1368 KB Output is correct
54 Correct 5 ms 1304 KB Output is correct
55 Correct 1 ms 980 KB Output is correct
56 Correct 4 ms 1236 KB Output is correct
57 Correct 5 ms 1364 KB Output is correct
58 Correct 5 ms 1364 KB Output is correct
59 Correct 5 ms 1364 KB Output is correct
60 Correct 4 ms 1236 KB Output is correct
61 Correct 1 ms 980 KB Output is correct
62 Correct 2 ms 1108 KB Output is correct
63 Correct 4 ms 1324 KB Output is correct
64 Correct 5 ms 1356 KB Output is correct
65 Correct 5 ms 1348 KB Output is correct
66 Correct 4 ms 1236 KB Output is correct
67 Correct 1 ms 980 KB Output is correct
68 Correct 1 ms 852 KB Output is correct
69 Correct 1 ms 880 KB Output is correct
70 Correct 1 ms 852 KB Output is correct
71 Correct 1 ms 852 KB Output is correct
72 Correct 3 ms 1148 KB Output is correct
73 Correct 4 ms 1236 KB Output is correct
74 Correct 4 ms 1236 KB Output is correct
75 Correct 3 ms 1108 KB Output is correct
76 Correct 2 ms 1108 KB Output is correct
77 Correct 4 ms 1328 KB Output is correct
78 Correct 7 ms 1492 KB Output is correct
79 Correct 8 ms 1492 KB Output is correct
80 Correct 10 ms 1364 KB Output is correct
81 Correct 4 ms 1108 KB Output is correct
82 Correct 3 ms 1108 KB Output is correct
83 Correct 5 ms 1364 KB Output is correct
84 Correct 4 ms 1236 KB Output is correct
85 Correct 1 ms 980 KB Output is correct
86 Correct 2 ms 1204 KB Output is correct
87 Correct 5 ms 1364 KB Output is correct
88 Correct 1 ms 980 KB Output is correct
89 Correct 14 ms 1964 KB Output is correct
90 Correct 17 ms 2644 KB Output is correct
91 Correct 15 ms 2632 KB Output is correct
92 Correct 9 ms 1748 KB Output is correct
93 Correct 10 ms 2000 KB Output is correct
94 Correct 18 ms 2700 KB Output is correct
95 Correct 8 ms 1736 KB Output is correct
96 Correct 18 ms 2928 KB Output is correct
97 Correct 27 ms 3944 KB Output is correct
98 Correct 31 ms 4336 KB Output is correct
99 Correct 28 ms 3868 KB Output is correct
100 Correct 18 ms 2560 KB Output is correct
101 Correct 1 ms 852 KB Output is correct
102 Correct 1 ms 852 KB Output is correct
103 Correct 17 ms 2896 KB Output is correct
104 Correct 1 ms 852 KB Output is correct
105 Correct 3 ms 1108 KB Output is correct
106 Correct 5 ms 1364 KB Output is correct
107 Correct 3 ms 1108 KB Output is correct
108 Correct 2 ms 1108 KB Output is correct
109 Correct 9 ms 1980 KB Output is correct
110 Correct 10 ms 2000 KB Output is correct
111 Correct 19 ms 2912 KB Output is correct
112 Correct 1 ms 852 KB Output is correct
113 Correct 1 ms 852 KB Output is correct
114 Correct 29 ms 3908 KB Output is correct
115 Correct 1 ms 980 KB Output is correct
116 Correct 2 ms 1108 KB Output is correct
117 Correct 13 ms 2320 KB Output is correct
118 Correct 14 ms 2480 KB Output is correct
119 Correct 42 ms 4300 KB Output is correct
120 Correct 30 ms 4276 KB Output is correct
121 Correct 31 ms 4280 KB Output is correct
122 Correct 32 ms 4232 KB Output is correct
123 Correct 17 ms 2896 KB Output is correct
124 Correct 28 ms 3940 KB Output is correct
125 Correct 32 ms 4232 KB Output is correct
126 Correct 32 ms 4300 KB Output is correct
127 Correct 29 ms 3876 KB Output is correct
128 Correct 17 ms 2516 KB Output is correct