답안 #761196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
761196 2023-06-19T10:54:50 Z raysh07 Vision Program (IOI19_vision) C++17
100 / 100
15 ms 2180 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
int ac[N];
int pos;
int loc[10]; //location of bits 

int cell(int i, int j, int m){
    return i * m + j;
}

// int add_xor(vector <int> b){
//     ac[pos] = 0;
//     for (auto x : b) ac[pos] ^= ac[x];
//     return pos++;
// }

// int add_and(vector <int> b){
//     ac[pos] = 1;
//     for (auto x : b) ac[pos] &= ac[x];
//     return pos++;
// }

// int add_or(vector <int> b){
//     ac[pos] = 0;
//     for (auto x : b) ac[pos] |= ac[x];
//     return pos++;
// }

// int add_not(int b){
//     ac[pos] = 1 - ac[b];
//     return pos++;
// }

void add(int x){
    for (int i = 0; i < 10; i++){
        int y = add_and({x, loc[i]});
        loc[i] = add_xor({x, loc[i]});
        x = y;
    }
}

void construct_network(int n, int m, int k) {
// 	std::vector<int> Ns;
// 	Ns = {0, 1};
// 	int a = add_and(Ns);
// 	Ns = {0, a};
// 	int b = add_or(Ns);
// 	Ns = {0, 1, b};
// 	int c = add_xor(Ns);
// 	add_not(c);

    vector <int> r;
    vector <int> a;
    for (int i = 0; i < n; i++){
        a.clear();
        for (int j = 0; j < m; j++) a.push_back(cell(i, j, m));
        
        int x = add_xor(a);
        r.push_back(x);
        
      ///  cout << i << " " << x << " " << ac[x] << "\n";
    }
    
    a.clear();
    for (auto &x : r){
        a.push_back(x);
        x = add_xor(a);
    ///    cout << x << " " << ac[x] << "\n";
    }
    
    vector <int> c;
    for (int j = 0; j < m; j++){
        a.clear();
        for (int i = 0; i < n; i++) a.push_back(cell(i, j, m));
        
        int x = add_xor(a);
        c.push_back(x);
        
     //   cout << j << " " << x << " " << ac[x] << "\n";
    }
    
    a.clear();
    for (auto &x : c){
        a.push_back(x);
        x = add_xor(a);
    }
    
    for (int i = 0; i < 10; i++){
        loc[i] = add_or({c.back()});
    }
    
    for (auto x : r){
        add(x);
    }
    for (auto x : c){
        add(x);
    }
    int ansloc = add_not(c.back());
    for (int i = 0; i < 10; i++){
        if (k >> i & 1){
            ansloc = add_and({ansloc, loc[i]});
        } else {
            loc[i] = add_not(loc[i]);
            ansloc = add_and({ansloc, loc[i]});
        }
    }
}

// int main(){
//     int h, w, k;
//     cin >> h >> w >> k;
//     pos = h * w;
//     for (int i = 0; i < h * w; i++) cin >> ac[i];
//     construct_network(h, w, k);
    
//     cout << ac[pos - 1] << "\n";
//     return 0;
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 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 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 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 212 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 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 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 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 212 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 312 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 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 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 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 212 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 312 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 340 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 392 KB Output is correct
32 Correct 1 ms 312 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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 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 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 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 212 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 312 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 340 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 392 KB Output is correct
32 Correct 1 ms 312 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 5 ms 980 KB Output is correct
39 Correct 2 ms 596 KB Output is correct
40 Correct 2 ms 564 KB Output is correct
41 Correct 3 ms 724 KB Output is correct
42 Correct 3 ms 724 KB Output is correct
43 Correct 5 ms 952 KB Output is correct
44 Correct 4 ms 952 KB Output is correct
45 Correct 4 ms 952 KB Output is correct
46 Correct 4 ms 952 KB Output is correct
47 Correct 5 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 4 ms 852 KB Output is correct
3 Correct 4 ms 852 KB Output is correct
4 Correct 4 ms 852 KB Output is correct
5 Correct 4 ms 820 KB Output is correct
6 Correct 5 ms 852 KB Output is correct
7 Correct 4 ms 852 KB Output is correct
8 Correct 4 ms 852 KB Output is correct
9 Correct 4 ms 852 KB Output is correct
10 Correct 5 ms 852 KB Output is correct
11 Correct 4 ms 852 KB Output is correct
12 Correct 4 ms 852 KB Output is correct
13 Correct 4 ms 904 KB Output is correct
14 Correct 4 ms 852 KB Output is correct
15 Correct 5 ms 852 KB Output is correct
16 Correct 4 ms 852 KB Output is correct
17 Correct 4 ms 852 KB Output is correct
18 Correct 4 ms 852 KB Output is correct
19 Correct 4 ms 948 KB Output is correct
20 Correct 4 ms 852 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
8 Correct 4 ms 724 KB Output is correct
9 Correct 4 ms 724 KB Output is correct
10 Correct 4 ms 732 KB Output is correct
11 Correct 4 ms 724 KB Output is correct
12 Correct 4 ms 724 KB Output is correct
13 Correct 4 ms 852 KB Output is correct
14 Correct 4 ms 852 KB Output is correct
15 Correct 4 ms 852 KB Output is correct
16 Correct 4 ms 852 KB Output is correct
17 Correct 4 ms 852 KB Output is correct
18 Correct 5 ms 852 KB Output is correct
19 Correct 4 ms 852 KB Output is correct
20 Correct 8 ms 1380 KB Output is correct
21 Correct 8 ms 1360 KB Output is correct
22 Correct 8 ms 1360 KB Output is correct
23 Correct 8 ms 1456 KB Output is correct
24 Correct 8 ms 1360 KB Output is correct
25 Correct 9 ms 1460 KB Output is correct
26 Correct 8 ms 1420 KB Output is correct
27 Correct 13 ms 2128 KB Output is correct
28 Correct 13 ms 2128 KB Output is correct
29 Correct 13 ms 2128 KB Output is correct
30 Correct 13 ms 2124 KB Output is correct
31 Correct 13 ms 2144 KB Output is correct
32 Correct 1 ms 312 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2128 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 724 KB Output is correct
5 Correct 3 ms 852 KB Output is correct
6 Correct 4 ms 852 KB Output is correct
7 Correct 8 ms 1360 KB Output is correct
8 Correct 8 ms 1456 KB Output is correct
9 Correct 15 ms 2080 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 308 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 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 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 212 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 312 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 340 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 392 KB Output is correct
32 Correct 1 ms 312 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 5 ms 980 KB Output is correct
39 Correct 2 ms 596 KB Output is correct
40 Correct 2 ms 564 KB Output is correct
41 Correct 3 ms 724 KB Output is correct
42 Correct 3 ms 724 KB Output is correct
43 Correct 5 ms 952 KB Output is correct
44 Correct 4 ms 952 KB Output is correct
45 Correct 4 ms 952 KB Output is correct
46 Correct 4 ms 952 KB Output is correct
47 Correct 5 ms 980 KB Output is correct
48 Correct 1 ms 852 KB Output is correct
49 Correct 4 ms 852 KB Output is correct
50 Correct 4 ms 852 KB Output is correct
51 Correct 4 ms 852 KB Output is correct
52 Correct 4 ms 820 KB Output is correct
53 Correct 5 ms 852 KB Output is correct
54 Correct 4 ms 852 KB Output is correct
55 Correct 4 ms 852 KB Output is correct
56 Correct 4 ms 852 KB Output is correct
57 Correct 5 ms 852 KB Output is correct
58 Correct 4 ms 852 KB Output is correct
59 Correct 4 ms 852 KB Output is correct
60 Correct 4 ms 904 KB Output is correct
61 Correct 4 ms 852 KB Output is correct
62 Correct 5 ms 852 KB Output is correct
63 Correct 4 ms 852 KB Output is correct
64 Correct 4 ms 852 KB Output is correct
65 Correct 4 ms 852 KB Output is correct
66 Correct 4 ms 948 KB Output is correct
67 Correct 4 ms 852 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 2 ms 596 KB Output is correct
73 Correct 2 ms 596 KB Output is correct
74 Correct 2 ms 564 KB Output is correct
75 Correct 3 ms 596 KB Output is correct
76 Correct 2 ms 568 KB Output is correct
77 Correct 4 ms 724 KB Output is correct
78 Correct 4 ms 724 KB Output is correct
79 Correct 4 ms 732 KB Output is correct
80 Correct 4 ms 724 KB Output is correct
81 Correct 4 ms 724 KB Output is correct
82 Correct 4 ms 852 KB Output is correct
83 Correct 4 ms 852 KB Output is correct
84 Correct 4 ms 852 KB Output is correct
85 Correct 4 ms 852 KB Output is correct
86 Correct 4 ms 852 KB Output is correct
87 Correct 5 ms 852 KB Output is correct
88 Correct 4 ms 852 KB Output is correct
89 Correct 8 ms 1380 KB Output is correct
90 Correct 8 ms 1360 KB Output is correct
91 Correct 8 ms 1360 KB Output is correct
92 Correct 8 ms 1456 KB Output is correct
93 Correct 8 ms 1360 KB Output is correct
94 Correct 9 ms 1460 KB Output is correct
95 Correct 8 ms 1420 KB Output is correct
96 Correct 13 ms 2128 KB Output is correct
97 Correct 13 ms 2128 KB Output is correct
98 Correct 13 ms 2128 KB Output is correct
99 Correct 13 ms 2124 KB Output is correct
100 Correct 13 ms 2144 KB Output is correct
101 Correct 1 ms 312 KB Output is correct
102 Correct 1 ms 312 KB Output is correct
103 Correct 14 ms 2128 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 724 KB Output is correct
107 Correct 3 ms 852 KB Output is correct
108 Correct 4 ms 852 KB Output is correct
109 Correct 8 ms 1360 KB Output is correct
110 Correct 8 ms 1456 KB Output is correct
111 Correct 15 ms 2080 KB Output is correct
112 Correct 1 ms 308 KB Output is correct
113 Correct 1 ms 312 KB Output is correct
114 Correct 13 ms 2076 KB Output is correct
115 Correct 4 ms 956 KB Output is correct
116 Correct 4 ms 852 KB Output is correct
117 Correct 8 ms 1488 KB Output is correct
118 Correct 8 ms 1488 KB Output is correct
119 Correct 14 ms 2128 KB Output is correct
120 Correct 13 ms 2128 KB Output is correct
121 Correct 13 ms 2148 KB Output is correct
122 Correct 13 ms 2068 KB Output is correct
123 Correct 13 ms 2180 KB Output is correct
124 Correct 13 ms 2120 KB Output is correct
125 Correct 13 ms 2124 KB Output is correct
126 Correct 13 ms 2088 KB Output is correct
127 Correct 13 ms 2128 KB Output is correct
128 Correct 13 ms 2128 KB Output is correct