답안 #579591

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579591 2022-06-19T12:27:25 Z keta_tsimakuridze Vision Program (IOI19_vision) C++17
100 / 100
76 ms 12004 KB
#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
const int N = 2e5 + 5;
int id_or[N], id_xor[N], cur;
int op = 0;
vector<int> X;
/*
void add_and(vector<int> Ns) {

    int x = 1;
    for(int i = 0; i < Ns.size(); i++) {
        x &= X[Ns[i]];
    }
    X.push_back(x);
}

void add_or(vector<int> Ns) {

    int x = 0;
    for(int i = 0; i < Ns.size(); i++) {
        x |= X[Ns[i]];
    }

    X.push_back(x);
}

void add_xor(vector<int> Ns) {

    int x = 0;
    for(int i = 0; i < Ns.size(); i++) {
        x ^= X[Ns[i]];
    }
    X.push_back(x);
}

void add_not(int N) {
	X.push_back(1^X[N]);
}
*/
vector<int> d[N];
int go(int n, int k) {
	vector<int> V;
	for(int i = 0; i < n; i++) {
		id_or[i] = ++cur; add_or(d[i]);
		id_xor[i] = ++cur; add_xor(d[i]);
		add_xor({cur, id_or[i]});
		V.push_back(++cur);
	}
	op += n * 4;
	for(int i = k; i < n; i++) {
		vector<int> v;
		for(int j = i - k ; j <= i; j++) {
			v.push_back(id_or[j]);
		}
		++cur;
		add_or(v);
		++cur;
		add_xor(v);
		add_xor({cur, cur - 1}); ++cur;
		V.push_back(cur);
	}
    op += n * 4;
	add_or(V); ++cur; op++;
	return cur;
}
void calc(int n, int m,int k) {
    for(int i = 0; i < n + m; i++) d[i].clear();
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			d[i - j + m - 1].push_back(i * m + j);
		}
	}
	int id1 = go(n + m - 1, k);
	for(int i = 0; i < n + m; i++) {
		d[i].clear();
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			d[i + j].push_back(i * m + j);
		}
	}
	int id2 = go(n + m - 1, k);
	add_and({id1, id2}); ++cur; op++;

}
void construct_network(int H, int W, int K) {
	cur = H * W; --cur;
	calc(H, W, K);
	int pcur = cur;
	calc(H, W, K - 1);
	add_xor({pcur, cur});
}
/*
int main() {
	int H, W, K;
	assert(3 == scanf("%d%d%d", &H, &W, &K));
	int r1,  c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            X.push_back(0);
        }
	}
	X[r1 * W + c1] = 1;
	X[r2 * W + c2] = 1;
	construct_network(H, W, K);
	cout << X.back() << endl;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5008 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 5012 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 5008 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5008 KB Output is correct
14 Correct 3 ms 5004 KB Output is correct
15 Correct 3 ms 5008 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 5008 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5008 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 5012 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 5008 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5008 KB Output is correct
14 Correct 3 ms 5004 KB Output is correct
15 Correct 3 ms 5008 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 5008 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 4948 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 4 ms 4948 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 4 ms 4948 KB Output is correct
24 Correct 3 ms 4948 KB Output is correct
25 Correct 5 ms 4948 KB Output is correct
26 Correct 3 ms 4948 KB Output is correct
27 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5008 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 5012 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 5008 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5008 KB Output is correct
14 Correct 3 ms 5004 KB Output is correct
15 Correct 3 ms 5008 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 5008 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 4948 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 4 ms 4948 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 4 ms 4948 KB Output is correct
24 Correct 3 ms 4948 KB Output is correct
25 Correct 5 ms 4948 KB Output is correct
26 Correct 3 ms 4948 KB Output is correct
27 Correct 3 ms 4948 KB Output is correct
28 Correct 5 ms 5132 KB Output is correct
29 Correct 4 ms 5076 KB Output is correct
30 Correct 3 ms 5004 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 5 ms 5136 KB Output is correct
33 Correct 5 ms 5076 KB Output is correct
34 Correct 5 ms 5136 KB Output is correct
35 Correct 7 ms 5204 KB Output is correct
36 Correct 5 ms 5076 KB Output is correct
37 Correct 4 ms 5076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5008 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 5012 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 5008 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5008 KB Output is correct
14 Correct 3 ms 5004 KB Output is correct
15 Correct 3 ms 5008 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 5008 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 4948 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 4 ms 4948 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 4 ms 4948 KB Output is correct
24 Correct 3 ms 4948 KB Output is correct
25 Correct 5 ms 4948 KB Output is correct
26 Correct 3 ms 4948 KB Output is correct
27 Correct 3 ms 4948 KB Output is correct
28 Correct 5 ms 5132 KB Output is correct
29 Correct 4 ms 5076 KB Output is correct
30 Correct 3 ms 5004 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 5 ms 5136 KB Output is correct
33 Correct 5 ms 5076 KB Output is correct
34 Correct 5 ms 5136 KB Output is correct
35 Correct 7 ms 5204 KB Output is correct
36 Correct 5 ms 5076 KB Output is correct
37 Correct 4 ms 5076 KB Output is correct
38 Correct 18 ms 6560 KB Output is correct
39 Correct 6 ms 5332 KB Output is correct
40 Correct 7 ms 5204 KB Output is correct
41 Correct 9 ms 5560 KB Output is correct
42 Correct 8 ms 5448 KB Output is correct
43 Correct 13 ms 6032 KB Output is correct
44 Correct 18 ms 6644 KB Output is correct
45 Correct 20 ms 6768 KB Output is correct
46 Correct 18 ms 6504 KB Output is correct
47 Correct 12 ms 5972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5332 KB Output is correct
2 Correct 13 ms 5972 KB Output is correct
3 Correct 12 ms 5972 KB Output is correct
4 Correct 5 ms 5204 KB Output is correct
5 Correct 6 ms 5392 KB Output is correct
6 Correct 14 ms 5816 KB Output is correct
7 Correct 15 ms 5844 KB Output is correct
8 Correct 5 ms 5204 KB Output is correct
9 Correct 6 ms 5332 KB Output is correct
10 Correct 10 ms 5840 KB Output is correct
11 Correct 13 ms 5972 KB Output is correct
12 Correct 12 ms 5972 KB Output is correct
13 Correct 13 ms 5716 KB Output is correct
14 Correct 4 ms 5204 KB Output is correct
15 Correct 7 ms 5332 KB Output is correct
16 Correct 10 ms 5772 KB Output is correct
17 Correct 13 ms 5904 KB Output is correct
18 Correct 11 ms 5956 KB Output is correct
19 Correct 10 ms 5716 KB Output is correct
20 Correct 5 ms 5204 KB Output is correct
21 Correct 3 ms 4948 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4928 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 7 ms 5460 KB Output is correct
4 Correct 8 ms 5588 KB Output is correct
5 Correct 10 ms 5644 KB Output is correct
6 Correct 9 ms 5588 KB Output is correct
7 Correct 6 ms 5264 KB Output is correct
8 Correct 10 ms 5712 KB Output is correct
9 Correct 14 ms 6120 KB Output is correct
10 Correct 20 ms 6220 KB Output is correct
11 Correct 12 ms 5972 KB Output is correct
12 Correct 9 ms 5588 KB Output is correct
13 Correct 5 ms 5332 KB Output is correct
14 Correct 11 ms 5900 KB Output is correct
15 Correct 14 ms 5852 KB Output is correct
16 Correct 6 ms 5204 KB Output is correct
17 Correct 6 ms 5392 KB Output is correct
18 Correct 13 ms 5992 KB Output is correct
19 Correct 6 ms 5204 KB Output is correct
20 Correct 21 ms 7052 KB Output is correct
21 Correct 35 ms 8520 KB Output is correct
22 Correct 36 ms 8520 KB Output is correct
23 Correct 26 ms 6780 KB Output is correct
24 Correct 22 ms 7056 KB Output is correct
25 Correct 38 ms 8664 KB Output is correct
26 Correct 19 ms 6868 KB Output is correct
27 Correct 43 ms 9052 KB Output is correct
28 Correct 70 ms 11252 KB Output is correct
29 Correct 69 ms 11976 KB Output is correct
30 Correct 62 ms 11112 KB Output is correct
31 Correct 40 ms 8648 KB Output is correct
32 Correct 3 ms 5016 KB Output is correct
33 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 8972 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 7 ms 5392 KB Output is correct
4 Correct 9 ms 5712 KB Output is correct
5 Correct 5 ms 5332 KB Output is correct
6 Correct 6 ms 5332 KB Output is correct
7 Correct 23 ms 7052 KB Output is correct
8 Correct 22 ms 7128 KB Output is correct
9 Correct 40 ms 8924 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 5008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5008 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 5012 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 5008 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 3 ms 5008 KB Output is correct
14 Correct 3 ms 5004 KB Output is correct
15 Correct 3 ms 5008 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 5008 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 4948 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 4 ms 4948 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 4 ms 4948 KB Output is correct
24 Correct 3 ms 4948 KB Output is correct
25 Correct 5 ms 4948 KB Output is correct
26 Correct 3 ms 4948 KB Output is correct
27 Correct 3 ms 4948 KB Output is correct
28 Correct 5 ms 5132 KB Output is correct
29 Correct 4 ms 5076 KB Output is correct
30 Correct 3 ms 5004 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 5 ms 5136 KB Output is correct
33 Correct 5 ms 5076 KB Output is correct
34 Correct 5 ms 5136 KB Output is correct
35 Correct 7 ms 5204 KB Output is correct
36 Correct 5 ms 5076 KB Output is correct
37 Correct 4 ms 5076 KB Output is correct
38 Correct 18 ms 6560 KB Output is correct
39 Correct 6 ms 5332 KB Output is correct
40 Correct 7 ms 5204 KB Output is correct
41 Correct 9 ms 5560 KB Output is correct
42 Correct 8 ms 5448 KB Output is correct
43 Correct 13 ms 6032 KB Output is correct
44 Correct 18 ms 6644 KB Output is correct
45 Correct 20 ms 6768 KB Output is correct
46 Correct 18 ms 6504 KB Output is correct
47 Correct 12 ms 5972 KB Output is correct
48 Correct 6 ms 5332 KB Output is correct
49 Correct 13 ms 5972 KB Output is correct
50 Correct 12 ms 5972 KB Output is correct
51 Correct 5 ms 5204 KB Output is correct
52 Correct 6 ms 5392 KB Output is correct
53 Correct 14 ms 5816 KB Output is correct
54 Correct 15 ms 5844 KB Output is correct
55 Correct 5 ms 5204 KB Output is correct
56 Correct 6 ms 5332 KB Output is correct
57 Correct 10 ms 5840 KB Output is correct
58 Correct 13 ms 5972 KB Output is correct
59 Correct 12 ms 5972 KB Output is correct
60 Correct 13 ms 5716 KB Output is correct
61 Correct 4 ms 5204 KB Output is correct
62 Correct 7 ms 5332 KB Output is correct
63 Correct 10 ms 5772 KB Output is correct
64 Correct 13 ms 5904 KB Output is correct
65 Correct 11 ms 5956 KB Output is correct
66 Correct 10 ms 5716 KB Output is correct
67 Correct 5 ms 5204 KB Output is correct
68 Correct 3 ms 4948 KB Output is correct
69 Correct 3 ms 4948 KB Output is correct
70 Correct 4 ms 4928 KB Output is correct
71 Correct 3 ms 4948 KB Output is correct
72 Correct 7 ms 5460 KB Output is correct
73 Correct 8 ms 5588 KB Output is correct
74 Correct 10 ms 5644 KB Output is correct
75 Correct 9 ms 5588 KB Output is correct
76 Correct 6 ms 5264 KB Output is correct
77 Correct 10 ms 5712 KB Output is correct
78 Correct 14 ms 6120 KB Output is correct
79 Correct 20 ms 6220 KB Output is correct
80 Correct 12 ms 5972 KB Output is correct
81 Correct 9 ms 5588 KB Output is correct
82 Correct 5 ms 5332 KB Output is correct
83 Correct 11 ms 5900 KB Output is correct
84 Correct 14 ms 5852 KB Output is correct
85 Correct 6 ms 5204 KB Output is correct
86 Correct 6 ms 5392 KB Output is correct
87 Correct 13 ms 5992 KB Output is correct
88 Correct 6 ms 5204 KB Output is correct
89 Correct 21 ms 7052 KB Output is correct
90 Correct 35 ms 8520 KB Output is correct
91 Correct 36 ms 8520 KB Output is correct
92 Correct 26 ms 6780 KB Output is correct
93 Correct 22 ms 7056 KB Output is correct
94 Correct 38 ms 8664 KB Output is correct
95 Correct 19 ms 6868 KB Output is correct
96 Correct 43 ms 9052 KB Output is correct
97 Correct 70 ms 11252 KB Output is correct
98 Correct 69 ms 11976 KB Output is correct
99 Correct 62 ms 11112 KB Output is correct
100 Correct 40 ms 8648 KB Output is correct
101 Correct 3 ms 5016 KB Output is correct
102 Correct 3 ms 4948 KB Output is correct
103 Correct 45 ms 8972 KB Output is correct
104 Correct 3 ms 4948 KB Output is correct
105 Correct 7 ms 5392 KB Output is correct
106 Correct 9 ms 5712 KB Output is correct
107 Correct 5 ms 5332 KB Output is correct
108 Correct 6 ms 5332 KB Output is correct
109 Correct 23 ms 7052 KB Output is correct
110 Correct 22 ms 7128 KB Output is correct
111 Correct 40 ms 8924 KB Output is correct
112 Correct 3 ms 4948 KB Output is correct
113 Correct 3 ms 5008 KB Output is correct
114 Correct 76 ms 11288 KB Output is correct
115 Correct 6 ms 5332 KB Output is correct
116 Correct 6 ms 5388 KB Output is correct
117 Correct 31 ms 7888 KB Output is correct
118 Correct 30 ms 8012 KB Output is correct
119 Correct 70 ms 11812 KB Output is correct
120 Correct 69 ms 11904 KB Output is correct
121 Correct 67 ms 11880 KB Output is correct
122 Correct 68 ms 11968 KB Output is correct
123 Correct 40 ms 9032 KB Output is correct
124 Correct 64 ms 11204 KB Output is correct
125 Correct 69 ms 12004 KB Output is correct
126 Correct 74 ms 11940 KB Output is correct
127 Correct 63 ms 11092 KB Output is correct
128 Correct 36 ms 8684 KB Output is correct