답안 #198800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198800 2020-01-27T18:19:49 Z Akashi Vision Program (IOI19_vision) C++14
59 / 100
46 ms 4084 KB
#include <bits/stdc++.h>
#include "vision.h"
 
using namespace std;
 
struct diags{
	int a, b, c;
};
 
int nr_right, nr_left;
diags right_diag[405], left_diag[405];

int check(int n, int m, int k){
	vector <int> v, v2;
	vector <int> pos;
	int left, right;
	
	///right diags
	for(int i = 1; i + k - 1 <= nr_right ; ++i){
		v.clear(); v2.clear();
		for(int j = i; j <= i + k - 1 ; ++j){
			v.push_back(right_diag[j].a);
			v2.push_back(right_diag[j].c);
		}
		
		int x = add_or(v);
		int y = add_xor(v);
		int z = add_or(v2);
	
		v.clear();
		v.push_back(x); v.push_back(add_not(y));
		pos.push_back(add_and(v));
		pos.push_back(z);
	}
	right = add_or(pos);
	pos.clear();
	
	///left diags
	for(int i = 1; i + k - 1 <= nr_left ; ++i){
		v.clear(); v2.clear();
		for(int j = i; j <= i + k - 1 ; ++j){
			v.push_back(left_diag[j].a);
			v2.push_back(left_diag[j].c);
		}
		
		int x = add_or(v);
		int y = add_xor(v);
		int z = add_or(v2);
	
		v.clear();
		v.push_back(x); v.push_back(add_not(y));
		pos.push_back(add_and(v));
		pos.push_back(z);
	}
	left = add_or(pos);
	
	
	v.clear();
	v.push_back(left); v.push_back(right);
	return add_and(v);
}

void construct_network(int n, int m, int k) {
	vector <int> v;
	int i, j;
	///right diags
	
	for(i = n - 1; i > 0 ; --i){
		int l = i, c = 0;
		v.clear();
		while(l < n && c < m){
			v.push_back(l * m + c);
			++l; ++c;
		}
		right_diag[++nr_right].a = add_or(v);
		right_diag[nr_right].b = add_xor(v);
	}
	
	for(j = 0; j < m ; ++j){
		int l = 0, c = j;
		v.clear();
		while(l < n && c < m){
			v.push_back(l * m + c);
			++l; ++c;
		}
		right_diag[++nr_right].a = add_or(v);
		right_diag[nr_right].b = add_xor(v);
	}
	
	for(int i = 1; i <= nr_right ; ++i){
		v.clear();
		v.push_back(right_diag[i].a);
		v.push_back(add_not(right_diag[i].b));
		right_diag[i].c = add_and(v);
	}
	
	///left diags
	
	for(i = n - 1; i > 0 ; --i){
		int l = i, c = m - 1;
		v.clear();
		while(l < n && c >= 0){
			v.push_back(l * m + c);
			++l; --c;
		}
		left_diag[++nr_left].a = add_or(v);
		left_diag[nr_left].b = add_xor(v);
	}
	
	for(j = m - 1; j >= 0 ; --j){
		int l = 0, c = j;
		v.clear();
		while(l < n && c >= 0){
			v.push_back(l * m + c);
			++l; --c;
		}
		left_diag[++nr_left].a = add_or(v);
		left_diag[nr_left].b = add_xor(v);
	}
	
	for(int i = 1; i <= nr_left ; ++i){
		v.clear();
		v.push_back(left_diag[i].a);
		v.push_back(add_not(left_diag[i].b));
		left_diag[i].c = add_and(v);
	}
		
	int ans1 = check(n, m, k + 1); 
	int ans2 = check(n, m, k);
	
	v.clear();
	v.push_back(add_not(ans2));
	v.push_back(ans1);
	add_and(v);

	return ;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 7 ms 504 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 504 KB Output is correct
33 Correct 7 ms 504 KB Output is correct
34 Correct 7 ms 504 KB Output is correct
35 Correct 7 ms 632 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 7 ms 504 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 504 KB Output is correct
33 Correct 7 ms 504 KB Output is correct
34 Correct 7 ms 504 KB Output is correct
35 Correct 7 ms 632 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
38 Correct 22 ms 1908 KB Output is correct
39 Correct 9 ms 760 KB Output is correct
40 Correct 9 ms 632 KB Output is correct
41 Correct 11 ms 884 KB Output is correct
42 Correct 9 ms 632 KB Output is correct
43 Correct 13 ms 1140 KB Output is correct
44 Correct 22 ms 1904 KB Output is correct
45 Correct 27 ms 2168 KB Output is correct
46 Correct 20 ms 1784 KB Output is correct
47 Correct 11 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 760 KB Output is correct
2 Correct 20 ms 1528 KB Output is correct
3 Correct 20 ms 1528 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 8 ms 760 KB Output is correct
6 Correct 19 ms 1524 KB Output is correct
7 Correct 18 ms 1400 KB Output is correct
8 Correct 7 ms 504 KB Output is correct
9 Correct 8 ms 760 KB Output is correct
10 Correct 17 ms 1396 KB Output is correct
11 Correct 22 ms 1656 KB Output is correct
12 Correct 20 ms 1656 KB Output is correct
13 Correct 17 ms 1272 KB Output is correct
14 Correct 6 ms 504 KB Output is correct
15 Correct 8 ms 760 KB Output is correct
16 Correct 18 ms 1396 KB Output is correct
17 Correct 20 ms 1656 KB Output is correct
18 Correct 20 ms 1656 KB Output is correct
19 Correct 16 ms 1272 KB Output is correct
20 Correct 6 ms 504 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 6 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 8 ms 760 KB Output is correct
4 Correct 12 ms 1016 KB Output is correct
5 Correct 13 ms 1016 KB Output is correct
6 Correct 12 ms 888 KB Output is correct
7 Correct 7 ms 504 KB Output is correct
8 Correct 11 ms 860 KB Output is correct
9 Correct 18 ms 1444 KB Output is correct
10 Correct 20 ms 1660 KB Output is correct
11 Correct 16 ms 1400 KB Output is correct
12 Correct 9 ms 636 KB Output is correct
13 Correct 8 ms 760 KB Output is correct
14 Correct 18 ms 1524 KB Output is correct
15 Correct 17 ms 1400 KB Output is correct
16 Correct 7 ms 508 KB Output is correct
17 Correct 8 ms 760 KB Output is correct
18 Correct 19 ms 1656 KB Output is correct
19 Correct 6 ms 504 KB Output is correct
20 Correct 19 ms 1824 KB Output is correct
21 Correct 43 ms 3932 KB Output is correct
22 Correct 42 ms 3828 KB Output is correct
23 Correct 16 ms 1400 KB Output is correct
24 Correct 19 ms 1776 KB Output is correct
25 Correct 46 ms 4084 KB Output is correct
26 Correct 17 ms 1272 KB Output is correct
27 Incorrect 7 ms 1652 KB WA in grader: Too many instructions
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1648 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 248 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 376 KB Output is correct
24 Correct 6 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 5 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 7 ms 504 KB Output is correct
29 Correct 6 ms 376 KB Output is correct
30 Correct 6 ms 376 KB Output is correct
31 Correct 6 ms 376 KB Output is correct
32 Correct 6 ms 504 KB Output is correct
33 Correct 7 ms 504 KB Output is correct
34 Correct 7 ms 504 KB Output is correct
35 Correct 7 ms 632 KB Output is correct
36 Correct 7 ms 504 KB Output is correct
37 Correct 6 ms 376 KB Output is correct
38 Correct 22 ms 1908 KB Output is correct
39 Correct 9 ms 760 KB Output is correct
40 Correct 9 ms 632 KB Output is correct
41 Correct 11 ms 884 KB Output is correct
42 Correct 9 ms 632 KB Output is correct
43 Correct 13 ms 1140 KB Output is correct
44 Correct 22 ms 1904 KB Output is correct
45 Correct 27 ms 2168 KB Output is correct
46 Correct 20 ms 1784 KB Output is correct
47 Correct 11 ms 888 KB Output is correct
48 Correct 8 ms 760 KB Output is correct
49 Correct 20 ms 1528 KB Output is correct
50 Correct 20 ms 1528 KB Output is correct
51 Correct 6 ms 504 KB Output is correct
52 Correct 8 ms 760 KB Output is correct
53 Correct 19 ms 1524 KB Output is correct
54 Correct 18 ms 1400 KB Output is correct
55 Correct 7 ms 504 KB Output is correct
56 Correct 8 ms 760 KB Output is correct
57 Correct 17 ms 1396 KB Output is correct
58 Correct 22 ms 1656 KB Output is correct
59 Correct 20 ms 1656 KB Output is correct
60 Correct 17 ms 1272 KB Output is correct
61 Correct 6 ms 504 KB Output is correct
62 Correct 8 ms 760 KB Output is correct
63 Correct 18 ms 1396 KB Output is correct
64 Correct 20 ms 1656 KB Output is correct
65 Correct 20 ms 1656 KB Output is correct
66 Correct 16 ms 1272 KB Output is correct
67 Correct 6 ms 504 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 6 ms 256 KB Output is correct
70 Correct 5 ms 256 KB Output is correct
71 Correct 5 ms 256 KB Output is correct
72 Correct 8 ms 760 KB Output is correct
73 Correct 12 ms 1016 KB Output is correct
74 Correct 13 ms 1016 KB Output is correct
75 Correct 12 ms 888 KB Output is correct
76 Correct 7 ms 504 KB Output is correct
77 Correct 11 ms 860 KB Output is correct
78 Correct 18 ms 1444 KB Output is correct
79 Correct 20 ms 1660 KB Output is correct
80 Correct 16 ms 1400 KB Output is correct
81 Correct 9 ms 636 KB Output is correct
82 Correct 8 ms 760 KB Output is correct
83 Correct 18 ms 1524 KB Output is correct
84 Correct 17 ms 1400 KB Output is correct
85 Correct 7 ms 508 KB Output is correct
86 Correct 8 ms 760 KB Output is correct
87 Correct 19 ms 1656 KB Output is correct
88 Correct 6 ms 504 KB Output is correct
89 Correct 19 ms 1824 KB Output is correct
90 Correct 43 ms 3932 KB Output is correct
91 Correct 42 ms 3828 KB Output is correct
92 Correct 16 ms 1400 KB Output is correct
93 Correct 19 ms 1776 KB Output is correct
94 Correct 46 ms 4084 KB Output is correct
95 Correct 17 ms 1272 KB Output is correct
96 Incorrect 7 ms 1652 KB WA in grader: Too many instructions
97 Halted 0 ms 0 KB -