Submission #577368

# Submission time Handle Problem Language Result Execution time Memory
577368 2022-06-14T15:46:42 Z AugustinasJucas Vision Program (IOI19_vision) C++14
100 / 100
49 ms 5320 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int toInd(int e, int s) {
    return e * m + s;
}
vector<int> getDiagonal1(int ind) {
    /// i + j = ind
    vector<int> ret;
    for(int i = 0; i < n; i++) {
        int j = ind - i;
        if(j < 0 || j >= m) continue;
        ret.push_back(toInd(i, j));
    }

    return ret;
}
vector<int> getDiagonal2(int ind) {
    /// i - j + m-1 = ind
    vector<int> ret;
    for(int i = 0; i < n; i++) {
        int j = i + m - 1 - ind;
        if(j < 0 || j >= m) continue;
        ret.push_back(toInd(i, j));
    }
    return ret;
}
void construct_network(int H, int W, int K) {
    n = H, m = W, k = K;

    vector<int> ors1, ors2, xors1, xors2;

    for(int i = 0; i < n + m-1; i++) {
        ors1.push_back(add_or(getDiagonal1(i)));
        ors2.push_back(add_or(getDiagonal2(i)));
        xors1.push_back(add_xor(getDiagonal1(i)));
        xors2.push_back(add_xor(getDiagonal2(i)));
    }

  /*  vector<int> du1, du2;
    for(int i = 0; i < n + m - 1; i++) {
        du1.push_back(add_and({ors1[i], xors1[i]}));
        du2.push_back(add_and({ors2[i], xors2[i]}));
    }

    int yraDu1 = add_or(du1);
    int yraDu2 = add_or(du2);
*/
    vector<int> yraDu1, yraDu2;
    for(int i = 0; i < n + m-1; i++) {
        vector<int> oras1, xoras1;
        for(int j = 0; j <= k; j++) {
            if(i + j >= n + m - 1) continue;
            oras1.push_back(ors1[i+j]);
            xoras1.push_back(xors1[i+j]);
        }
        int bendrasOras = add_or(oras1);
        int bendrasXoras = add_xor(xoras1);
        int notBendrasXoras = add_not(bendrasXoras);

        yraDu1.push_back(add_and({bendrasOras, notBendrasXoras}));
    }
    for(int i = 0; i < n + m-1; i++) {
        vector<int> oras2, xoras2;
        for(int j = 0; j <= k; j++) {
            if(j + i >= n + m - 1) continue;
            oras2.push_back(ors2[i+j]);
            xoras2.push_back(xors2[i+j]);
        }

        int bendrasOras = add_or(oras2);
        int bendrasXoras = add_xor(xoras2);
        int notBendrasXoras = add_not(bendrasXoras);

        yraDu2.push_back(add_and({bendrasOras, notBendrasXoras}));
    }


    int artiPagal1 = add_or(yraDu1);
    int artiPagal2 = add_or(yraDu2);

    vector<int> lygiaiK1, lygiaiK2;
    for(int i = 0; i+k < n+m-1; i++) {
        lygiaiK1.push_back(add_and({ors1[i], ors1[i+k]}));
        lygiaiK2.push_back(add_and({ors2[i], ors2[i+k]}));
    }

    int yraLygiai1 = add_or(lygiaiK1);
    int yraLygiai2 = add_or(lygiaiK2);

    int yraLygiai = add_or({yraLygiai1, yraLygiai2});
    int yraArti = add_and({artiPagal1, artiPagal2});

    int yraLygiaiK = add_and({yraLygiai, yraArti});

}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:95:9: warning: unused variable 'yraLygiaiK' [-Wunused-variable]
   95 |     int yraLygiaiK = add_and({yraLygiai, yraArti});
      |         ^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 292 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 292 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 296 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 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 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 292 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 296 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 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 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 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 376 KB Output is correct
34 Correct 2 ms 304 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 292 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 296 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 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 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 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 376 KB Output is correct
34 Correct 2 ms 304 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 432 KB Output is correct
38 Correct 9 ms 1144 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 3 ms 556 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 7 ms 980 KB Output is correct
43 Correct 5 ms 900 KB Output is correct
44 Correct 8 ms 1176 KB Output is correct
45 Correct 10 ms 1392 KB Output is correct
46 Correct 12 ms 1492 KB Output is correct
47 Correct 16 ms 1564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 7 ms 980 KB Output is correct
3 Correct 7 ms 980 KB Output is correct
4 Correct 9 ms 1108 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 8 ms 808 KB Output is correct
7 Correct 8 ms 1056 KB Output is correct
8 Correct 8 ms 1088 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 5 ms 724 KB Output is correct
11 Correct 8 ms 940 KB Output is correct
12 Correct 7 ms 980 KB Output is correct
13 Correct 8 ms 1068 KB Output is correct
14 Correct 11 ms 1052 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 6 ms 724 KB Output is correct
17 Correct 7 ms 880 KB Output is correct
18 Correct 7 ms 980 KB Output is correct
19 Correct 8 ms 1108 KB Output is correct
20 Correct 9 ms 1108 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 5 ms 596 KB Output is correct
5 Correct 5 ms 724 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 5 ms 724 KB Output is correct
8 Correct 4 ms 724 KB Output is correct
9 Correct 7 ms 880 KB Output is correct
10 Correct 8 ms 1108 KB Output is correct
11 Correct 10 ms 1236 KB Output is correct
12 Correct 10 ms 1172 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 6 ms 724 KB Output is correct
15 Correct 8 ms 1068 KB Output is correct
16 Correct 9 ms 1136 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 7 ms 980 KB Output is correct
19 Correct 9 ms 1108 KB Output is correct
20 Correct 10 ms 1360 KB Output is correct
21 Correct 18 ms 2260 KB Output is correct
22 Correct 25 ms 2836 KB Output is correct
23 Correct 26 ms 3028 KB Output is correct
24 Correct 11 ms 1360 KB Output is correct
25 Correct 23 ms 2644 KB Output is correct
26 Correct 26 ms 3020 KB Output is correct
27 Correct 17 ms 2252 KB Output is correct
28 Correct 39 ms 3540 KB Output is correct
29 Correct 40 ms 4572 KB Output is correct
30 Correct 44 ms 5124 KB Output is correct
31 Correct 49 ms 5320 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 18 ms 2256 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 2 ms 560 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 14 ms 1488 KB Output is correct
8 Correct 10 ms 1316 KB Output is correct
9 Correct 19 ms 2168 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 292 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 296 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 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 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 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 376 KB Output is correct
34 Correct 2 ms 304 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 432 KB Output is correct
38 Correct 9 ms 1144 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 3 ms 556 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 7 ms 980 KB Output is correct
43 Correct 5 ms 900 KB Output is correct
44 Correct 8 ms 1176 KB Output is correct
45 Correct 10 ms 1392 KB Output is correct
46 Correct 12 ms 1492 KB Output is correct
47 Correct 16 ms 1564 KB Output is correct
48 Correct 2 ms 468 KB Output is correct
49 Correct 7 ms 980 KB Output is correct
50 Correct 7 ms 980 KB Output is correct
51 Correct 9 ms 1108 KB Output is correct
52 Correct 2 ms 468 KB Output is correct
53 Correct 8 ms 808 KB Output is correct
54 Correct 8 ms 1056 KB Output is correct
55 Correct 8 ms 1088 KB Output is correct
56 Correct 2 ms 468 KB Output is correct
57 Correct 5 ms 724 KB Output is correct
58 Correct 8 ms 940 KB Output is correct
59 Correct 7 ms 980 KB Output is correct
60 Correct 8 ms 1068 KB Output is correct
61 Correct 11 ms 1052 KB Output is correct
62 Correct 2 ms 468 KB Output is correct
63 Correct 6 ms 724 KB Output is correct
64 Correct 7 ms 880 KB Output is correct
65 Correct 7 ms 980 KB Output is correct
66 Correct 8 ms 1108 KB Output is correct
67 Correct 9 ms 1108 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 304 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 0 ms 304 KB Output is correct
72 Correct 2 ms 468 KB Output is correct
73 Correct 5 ms 596 KB Output is correct
74 Correct 5 ms 724 KB Output is correct
75 Correct 5 ms 724 KB Output is correct
76 Correct 5 ms 724 KB Output is correct
77 Correct 4 ms 724 KB Output is correct
78 Correct 7 ms 880 KB Output is correct
79 Correct 8 ms 1108 KB Output is correct
80 Correct 10 ms 1236 KB Output is correct
81 Correct 10 ms 1172 KB Output is correct
82 Correct 2 ms 468 KB Output is correct
83 Correct 6 ms 724 KB Output is correct
84 Correct 8 ms 1068 KB Output is correct
85 Correct 9 ms 1136 KB Output is correct
86 Correct 2 ms 468 KB Output is correct
87 Correct 7 ms 980 KB Output is correct
88 Correct 9 ms 1108 KB Output is correct
89 Correct 10 ms 1360 KB Output is correct
90 Correct 18 ms 2260 KB Output is correct
91 Correct 25 ms 2836 KB Output is correct
92 Correct 26 ms 3028 KB Output is correct
93 Correct 11 ms 1360 KB Output is correct
94 Correct 23 ms 2644 KB Output is correct
95 Correct 26 ms 3020 KB Output is correct
96 Correct 17 ms 2252 KB Output is correct
97 Correct 39 ms 3540 KB Output is correct
98 Correct 40 ms 4572 KB Output is correct
99 Correct 44 ms 5124 KB Output is correct
100 Correct 49 ms 5320 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 18 ms 2256 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 3 ms 468 KB Output is correct
106 Correct 4 ms 724 KB Output is correct
107 Correct 2 ms 560 KB Output is correct
108 Correct 3 ms 468 KB Output is correct
109 Correct 14 ms 1488 KB Output is correct
110 Correct 10 ms 1316 KB Output is correct
111 Correct 19 ms 2168 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 38 ms 3604 KB Output is correct
115 Correct 8 ms 1052 KB Output is correct
116 Correct 2 ms 468 KB Output is correct
117 Correct 28 ms 3012 KB Output is correct
118 Correct 17 ms 1836 KB Output is correct
119 Correct 39 ms 4464 KB Output is correct
120 Correct 39 ms 4512 KB Output is correct
121 Correct 40 ms 4472 KB Output is correct
122 Correct 44 ms 4576 KB Output is correct
123 Correct 18 ms 2224 KB Output is correct
124 Correct 31 ms 3528 KB Output is correct
125 Correct 46 ms 4552 KB Output is correct
126 Correct 42 ms 4544 KB Output is correct
127 Correct 44 ms 5072 KB Output is correct
128 Correct 47 ms 5300 KB Output is correct