답안 #819801

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819801 2023-08-10T13:42:39 Z Lobo Vision Program (IOI19_vision) C++17
100 / 100
97 ms 7776 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
#define mp make_pair
#define all(x) x.begin(),x.end()

void construct_network(int n, int m, int K) {
	map<int,int> diagdw,diagup;
	for(int it = 0; it <= n+m-2; it++) {
		int i,j;
		if(it <= n-1) {
			i = n-1-it;
			j = 0;
		}
		else {
			i = 0;
			j = it-n+1;
		}

		int i0,j0;
		vector<int> diag;

		i0 = i-i;
		j0 = j-i;

		while(i0 <= n-1) {
			if(i0 >= 0 && i0 <= n-1 && j0 >= 0 && j0 <= m-1) diag.pb(i0*m+j0);
			i0++;
			j0++;
		}

		diagdw[i-j] = add_or(diag);

		if(it <= n-1) {
			i = it;
			j = 0;
		}
		else {
			i = n-1;
			j = it-n+1;
		}

		diag.clear();

		i0 = i-i;
		j0 = j+i;

		while(i0 <= n-1) {
			if(i0 >= 0 && i0 <= n-1 && j0 >= 0 && j0 <= m-1) diag.pb(i0*m+j0);
			
			i0++;
			j0--;
		}

		diagup[i+j] = add_or(diag);
	}

	vector<int> checks0;
	for(int add = 0; K+add <= n+m-2 && add <= 1; add+= 1) {
		int k = K+add;
		vector<int> checks;
		for(int it = 0; it <= n+m-2; it++) {
			int i,j;
			if(it <= n-1) {
				i = n-1-it;
				j = 0;
			}
			else {
				i = 0;
				j = it-n+1;
			}

			vector<int> diag0,diag1;
			int i0,j0,i1,j1;

			i0 = i-i;
			j0 = j-i;
			i1 = i-i;
			j1 = j+k-i;

			for(int jj = -n-m; jj <= j0; jj++) {
				if(diagdw.count(i0-jj)) diag0.pb(diagdw[i0-jj]);
			}

			for(int jj = j1; jj <= n+m; jj++) {
				if(diagdw.count(i1-jj)) diag1.pb(diagdw[i1-jj]);
			}

			if(diag0.size() && diag1.size()) checks.pb(add_and(vector<int>{add_or(diag0),add_or(diag1)}));
			
			diag0.clear();
			diag1.clear();

			if(it <= n-1) {
				i = it;
				j = 0;
			}
			else {
				i = n-1;
				j = it-n+1;
			}

			i0 = i-i;
			j0 = j+i;
			i1 = i-i;
			j1 = j+k+i;

			for(int jj = -n-m; jj <= j0; jj++) {
				if(diagup.count(i0+jj)) diag0.pb(diagup[i0+jj]);
			}

			for(int jj = j1; jj <= n+m; jj++) {
				if(diagup.count(i1+jj)) diag1.pb(diagup[i1+jj]);
			}

			if(diag0.size() && diag1.size()) checks.pb(add_and(vector<int>{add_or(diag0),add_or(diag1)}));
		}

		if(add == 0) checks0.pb(add_or(checks));
		else checks0.pb(add_not(add_or(checks)));
	}

	add_and(checks0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 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 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 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 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 14 ms 1548 KB Output is correct
39 Correct 4 ms 468 KB Output is correct
40 Correct 2 ms 296 KB Output is correct
41 Correct 12 ms 1288 KB Output is correct
42 Correct 3 ms 340 KB Output is correct
43 Correct 21 ms 2180 KB Output is correct
44 Correct 17 ms 1444 KB Output is correct
45 Correct 9 ms 980 KB Output is correct
46 Correct 7 ms 580 KB Output is correct
47 Correct 4 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1764 KB Output is correct
2 Correct 10 ms 708 KB Output is correct
3 Correct 7 ms 724 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 19 ms 1716 KB Output is correct
6 Correct 11 ms 980 KB Output is correct
7 Correct 6 ms 468 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 19 ms 1748 KB Output is correct
10 Correct 12 ms 1152 KB Output is correct
11 Correct 8 ms 724 KB Output is correct
12 Correct 8 ms 648 KB Output is correct
13 Correct 5 ms 468 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 19 ms 1748 KB Output is correct
16 Correct 13 ms 1108 KB Output is correct
17 Correct 8 ms 672 KB Output is correct
18 Correct 8 ms 724 KB Output is correct
19 Correct 5 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 9 ms 952 KB Output is correct
4 Correct 6 ms 768 KB Output is correct
5 Correct 4 ms 596 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 16 ms 1648 KB Output is correct
9 Correct 11 ms 1108 KB Output is correct
10 Correct 7 ms 724 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 3 ms 424 KB Output is correct
13 Correct 19 ms 1776 KB Output is correct
14 Correct 11 ms 1100 KB Output is correct
15 Correct 5 ms 468 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 19 ms 1704 KB Output is correct
18 Correct 8 ms 724 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 48 ms 4432 KB Output is correct
21 Correct 31 ms 2436 KB Output is correct
22 Correct 16 ms 1124 KB Output is correct
23 Correct 7 ms 724 KB Output is correct
24 Correct 49 ms 4524 KB Output is correct
25 Correct 20 ms 1756 KB Output is correct
26 Correct 7 ms 724 KB Output is correct
27 Correct 95 ms 7720 KB Output is correct
28 Correct 60 ms 4968 KB Output is correct
29 Correct 39 ms 2872 KB Output is correct
30 Correct 26 ms 1512 KB Output is correct
31 Correct 14 ms 1108 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 7724 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 10 ms 980 KB Output is correct
4 Correct 16 ms 1708 KB Output is correct
5 Correct 21 ms 1680 KB Output is correct
6 Correct 24 ms 1744 KB Output is correct
7 Correct 49 ms 4424 KB Output is correct
8 Correct 48 ms 4488 KB Output is correct
9 Correct 95 ms 7680 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 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 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 2 ms 340 KB Output is correct
35 Correct 2 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 14 ms 1548 KB Output is correct
39 Correct 4 ms 468 KB Output is correct
40 Correct 2 ms 296 KB Output is correct
41 Correct 12 ms 1288 KB Output is correct
42 Correct 3 ms 340 KB Output is correct
43 Correct 21 ms 2180 KB Output is correct
44 Correct 17 ms 1444 KB Output is correct
45 Correct 9 ms 980 KB Output is correct
46 Correct 7 ms 580 KB Output is correct
47 Correct 4 ms 468 KB Output is correct
48 Correct 19 ms 1764 KB Output is correct
49 Correct 10 ms 708 KB Output is correct
50 Correct 7 ms 724 KB Output is correct
51 Correct 3 ms 340 KB Output is correct
52 Correct 19 ms 1716 KB Output is correct
53 Correct 11 ms 980 KB Output is correct
54 Correct 6 ms 468 KB Output is correct
55 Correct 3 ms 340 KB Output is correct
56 Correct 19 ms 1748 KB Output is correct
57 Correct 12 ms 1152 KB Output is correct
58 Correct 8 ms 724 KB Output is correct
59 Correct 8 ms 648 KB Output is correct
60 Correct 5 ms 468 KB Output is correct
61 Correct 2 ms 340 KB Output is correct
62 Correct 19 ms 1748 KB Output is correct
63 Correct 13 ms 1108 KB Output is correct
64 Correct 8 ms 672 KB Output is correct
65 Correct 8 ms 724 KB Output is correct
66 Correct 5 ms 340 KB Output is correct
67 Correct 2 ms 340 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 9 ms 952 KB Output is correct
73 Correct 6 ms 768 KB Output is correct
74 Correct 4 ms 596 KB Output is correct
75 Correct 3 ms 340 KB Output is correct
76 Correct 2 ms 340 KB Output is correct
77 Correct 16 ms 1648 KB Output is correct
78 Correct 11 ms 1108 KB Output is correct
79 Correct 7 ms 724 KB Output is correct
80 Correct 5 ms 468 KB Output is correct
81 Correct 3 ms 424 KB Output is correct
82 Correct 19 ms 1776 KB Output is correct
83 Correct 11 ms 1100 KB Output is correct
84 Correct 5 ms 468 KB Output is correct
85 Correct 2 ms 340 KB Output is correct
86 Correct 19 ms 1704 KB Output is correct
87 Correct 8 ms 724 KB Output is correct
88 Correct 3 ms 340 KB Output is correct
89 Correct 48 ms 4432 KB Output is correct
90 Correct 31 ms 2436 KB Output is correct
91 Correct 16 ms 1124 KB Output is correct
92 Correct 7 ms 724 KB Output is correct
93 Correct 49 ms 4524 KB Output is correct
94 Correct 20 ms 1756 KB Output is correct
95 Correct 7 ms 724 KB Output is correct
96 Correct 95 ms 7720 KB Output is correct
97 Correct 60 ms 4968 KB Output is correct
98 Correct 39 ms 2872 KB Output is correct
99 Correct 26 ms 1512 KB Output is correct
100 Correct 14 ms 1108 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 97 ms 7724 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 10 ms 980 KB Output is correct
106 Correct 16 ms 1708 KB Output is correct
107 Correct 21 ms 1680 KB Output is correct
108 Correct 24 ms 1744 KB Output is correct
109 Correct 49 ms 4424 KB Output is correct
110 Correct 48 ms 4488 KB Output is correct
111 Correct 95 ms 7680 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 0 ms 212 KB Output is correct
114 Correct 60 ms 4892 KB Output is correct
115 Correct 4 ms 340 KB Output is correct
116 Correct 19 ms 1648 KB Output is correct
117 Correct 12 ms 788 KB Output is correct
118 Correct 36 ms 3364 KB Output is correct
119 Correct 46 ms 2780 KB Output is correct
120 Correct 40 ms 2780 KB Output is correct
121 Correct 38 ms 2860 KB Output is correct
122 Correct 39 ms 2848 KB Output is correct
123 Correct 96 ms 7776 KB Output is correct
124 Correct 60 ms 4964 KB Output is correct
125 Correct 39 ms 2868 KB Output is correct
126 Correct 39 ms 2796 KB Output is correct
127 Correct 26 ms 1612 KB Output is correct
128 Correct 14 ms 1064 KB Output is correct