Submission #1038783

# Submission time Handle Problem Language Result Execution time Memory
1038783 2024-07-30T07:36:31 Z AmirAli_H1 Vision Program (IOI19_vision) C++17
100 / 100
53 ms 8952 KB
// In the name of Allah

#include <bits/stdc++.h>
#include "vision.h"
using namespace std;

typedef		long long int			ll;
typedef		long double				ld;
typedef		pair<int, int>			pii;
typedef		pair<ll, ll>			pll;
typedef		complex<ld>				cld;

#define		all(x)					(x).begin(),(x).end()
#define		len(x)					((ll) (x).size())
#define		F						first
#define		S						second
#define		pb						push_back
#define		sep						' '
#define		endl					'\n'
#define		Mp						make_pair
#define		kill(x)					cout << x << '\n', exit(0)
#define		set_dec(x)				cout << fixed << setprecision(x);
#define		file_io(x,y)			freopen(x, "r", stdin); freopen(y, "w", stdout);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int maxlg = 9;

int n, m, k;
vector<int> ls1, ls2, vc;
vector<int> ls, lsx;

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

void construct_network(int H, int W, int K) {
	n = H; m = W; k = K;
	
	for (int i = n - 1; i >= 0; i--) {
		vc.clear();
		for (int j = 0; j < m; j++) vc.pb(GI(i, j));
		if (len(ls1) >= 1) vc.pb(ls1.back());
		ls1.pb(add_xor(vc));
	}
	for (int j = m - 1; j >= 0; j--) {
		vc.clear();
		for (int i = 0; i < n; i++) vc.pb(GI(i, j));
		if (len(ls2) >= 1) vc.pb(ls2.back());
		ls2.pb(add_xor(vc));
	}
	
	for (int x : ls1) ls.pb(x);
	for (int x : ls2) ls.pb(x);
	reverse(all(ls));
	
	for (int j = 0; j < maxlg; j++) {
		if (k & (1 << j)) lsx.pb(add_xor(ls));
		else lsx.pb(add_not(add_xor(ls)));
		
		vc.clear();
		ls1.clear(); ls2.clear();
		for (int i = 0; i < len(ls); i++) {
			vc.pb(ls[i]);
			ls1.pb(add_xor(vc));
		}
		for (int i = 0; i < len(ls); i++) {
			if (i == 0) ls2.pb(add_and({ls[i]}));
			else ls2.pb(add_and({ls[i], ls1[i - 1]}));
		}
		ls = ls2;
	}
	
	add_and(lsx);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 2 ms 600 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 2 ms 600 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 13 ms 2648 KB Output is correct
39 Correct 3 ms 860 KB Output is correct
40 Correct 3 ms 860 KB Output is correct
41 Correct 7 ms 1628 KB Output is correct
42 Correct 7 ms 1628 KB Output is correct
43 Correct 12 ms 2648 KB Output is correct
44 Correct 12 ms 2648 KB Output is correct
45 Correct 12 ms 2652 KB Output is correct
46 Correct 12 ms 2652 KB Output is correct
47 Correct 11 ms 2612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2136 KB Output is correct
2 Correct 11 ms 2136 KB Output is correct
3 Correct 11 ms 2072 KB Output is correct
4 Correct 10 ms 2140 KB Output is correct
5 Correct 11 ms 2140 KB Output is correct
6 Correct 11 ms 2140 KB Output is correct
7 Correct 10 ms 2140 KB Output is correct
8 Correct 10 ms 2136 KB Output is correct
9 Correct 11 ms 2140 KB Output is correct
10 Correct 11 ms 2304 KB Output is correct
11 Correct 10 ms 2140 KB Output is correct
12 Correct 10 ms 2140 KB Output is correct
13 Correct 11 ms 2088 KB Output is correct
14 Correct 10 ms 2140 KB Output is correct
15 Correct 12 ms 2136 KB Output is correct
16 Correct 10 ms 2136 KB Output is correct
17 Correct 10 ms 2136 KB Output is correct
18 Correct 12 ms 2136 KB Output is correct
19 Correct 10 ms 2136 KB Output is correct
20 Correct 11 ms 2136 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 5 ms 1372 KB Output is correct
4 Correct 5 ms 1112 KB Output is correct
5 Correct 5 ms 1116 KB Output is correct
6 Correct 5 ms 1116 KB Output is correct
7 Correct 5 ms 1116 KB Output is correct
8 Correct 9 ms 2048 KB Output is correct
9 Correct 9 ms 1880 KB Output is correct
10 Correct 9 ms 1884 KB Output is correct
11 Correct 9 ms 1884 KB Output is correct
12 Correct 9 ms 1884 KB Output is correct
13 Correct 10 ms 2140 KB Output is correct
14 Correct 11 ms 2140 KB Output is correct
15 Correct 11 ms 2276 KB Output is correct
16 Correct 11 ms 2136 KB Output is correct
17 Correct 10 ms 2136 KB Output is correct
18 Correct 13 ms 2140 KB Output is correct
19 Correct 10 ms 2136 KB Output is correct
20 Correct 25 ms 5080 KB Output is correct
21 Correct 25 ms 5068 KB Output is correct
22 Correct 25 ms 5076 KB Output is correct
23 Correct 25 ms 5080 KB Output is correct
24 Correct 31 ms 5072 KB Output is correct
25 Correct 25 ms 5068 KB Output is correct
26 Correct 28 ms 5080 KB Output is correct
27 Correct 47 ms 8908 KB Output is correct
28 Correct 45 ms 8912 KB Output is correct
29 Correct 45 ms 8908 KB Output is correct
30 Correct 44 ms 8912 KB Output is correct
31 Correct 44 ms 8912 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 8908 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 5 ms 1116 KB Output is correct
4 Correct 9 ms 1884 KB Output is correct
5 Correct 11 ms 2304 KB Output is correct
6 Correct 10 ms 2136 KB Output is correct
7 Correct 27 ms 5068 KB Output is correct
8 Correct 25 ms 5068 KB Output is correct
9 Correct 44 ms 8952 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 2 ms 600 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 13 ms 2648 KB Output is correct
39 Correct 3 ms 860 KB Output is correct
40 Correct 3 ms 860 KB Output is correct
41 Correct 7 ms 1628 KB Output is correct
42 Correct 7 ms 1628 KB Output is correct
43 Correct 12 ms 2648 KB Output is correct
44 Correct 12 ms 2648 KB Output is correct
45 Correct 12 ms 2652 KB Output is correct
46 Correct 12 ms 2652 KB Output is correct
47 Correct 11 ms 2612 KB Output is correct
48 Correct 11 ms 2136 KB Output is correct
49 Correct 11 ms 2136 KB Output is correct
50 Correct 11 ms 2072 KB Output is correct
51 Correct 10 ms 2140 KB Output is correct
52 Correct 11 ms 2140 KB Output is correct
53 Correct 11 ms 2140 KB Output is correct
54 Correct 10 ms 2140 KB Output is correct
55 Correct 10 ms 2136 KB Output is correct
56 Correct 11 ms 2140 KB Output is correct
57 Correct 11 ms 2304 KB Output is correct
58 Correct 10 ms 2140 KB Output is correct
59 Correct 10 ms 2140 KB Output is correct
60 Correct 11 ms 2088 KB Output is correct
61 Correct 10 ms 2140 KB Output is correct
62 Correct 12 ms 2136 KB Output is correct
63 Correct 10 ms 2136 KB Output is correct
64 Correct 10 ms 2136 KB Output is correct
65 Correct 12 ms 2136 KB Output is correct
66 Correct 10 ms 2136 KB Output is correct
67 Correct 11 ms 2136 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 604 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 5 ms 1372 KB Output is correct
73 Correct 5 ms 1112 KB Output is correct
74 Correct 5 ms 1116 KB Output is correct
75 Correct 5 ms 1116 KB Output is correct
76 Correct 5 ms 1116 KB Output is correct
77 Correct 9 ms 2048 KB Output is correct
78 Correct 9 ms 1880 KB Output is correct
79 Correct 9 ms 1884 KB Output is correct
80 Correct 9 ms 1884 KB Output is correct
81 Correct 9 ms 1884 KB Output is correct
82 Correct 10 ms 2140 KB Output is correct
83 Correct 11 ms 2140 KB Output is correct
84 Correct 11 ms 2276 KB Output is correct
85 Correct 11 ms 2136 KB Output is correct
86 Correct 10 ms 2136 KB Output is correct
87 Correct 13 ms 2140 KB Output is correct
88 Correct 10 ms 2136 KB Output is correct
89 Correct 25 ms 5080 KB Output is correct
90 Correct 25 ms 5068 KB Output is correct
91 Correct 25 ms 5076 KB Output is correct
92 Correct 25 ms 5080 KB Output is correct
93 Correct 31 ms 5072 KB Output is correct
94 Correct 25 ms 5068 KB Output is correct
95 Correct 28 ms 5080 KB Output is correct
96 Correct 47 ms 8908 KB Output is correct
97 Correct 45 ms 8912 KB Output is correct
98 Correct 45 ms 8908 KB Output is correct
99 Correct 44 ms 8912 KB Output is correct
100 Correct 44 ms 8912 KB Output is correct
101 Correct 0 ms 344 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 45 ms 8908 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 5 ms 1116 KB Output is correct
106 Correct 9 ms 1884 KB Output is correct
107 Correct 11 ms 2304 KB Output is correct
108 Correct 10 ms 2136 KB Output is correct
109 Correct 27 ms 5068 KB Output is correct
110 Correct 25 ms 5068 KB Output is correct
111 Correct 44 ms 8952 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 0 ms 348 KB Output is correct
114 Correct 44 ms 8912 KB Output is correct
115 Correct 12 ms 2136 KB Output is correct
116 Correct 10 ms 2140 KB Output is correct
117 Correct 25 ms 5076 KB Output is correct
118 Correct 31 ms 5080 KB Output is correct
119 Correct 44 ms 8752 KB Output is correct
120 Correct 43 ms 8784 KB Output is correct
121 Correct 43 ms 8908 KB Output is correct
122 Correct 53 ms 8888 KB Output is correct
123 Correct 44 ms 8912 KB Output is correct
124 Correct 44 ms 8780 KB Output is correct
125 Correct 44 ms 8908 KB Output is correct
126 Correct 44 ms 8920 KB Output is correct
127 Correct 49 ms 8916 KB Output is correct
128 Correct 44 ms 8892 KB Output is correct