Submission #297674

# Submission time Handle Problem Language Result Execution time Memory
297674 2020-09-11T17:51:23 Z _7_7_ Vision Program (IOI19_vision) C++14
100 / 100
51 ms 5056 KB
#include "vision.h"
#include <bits/stdc++.h>                                           
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;  
typedef unsigned long long ull;         
typedef vector < pii > vpii;                                   	
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;
 
typedef tree < int, null_type, less < int >, rb_tree_tag, tree_order_statistics_node_update > ordered_set;
 
const int inf = 1e9, maxn = 2e5 + 48, mod = 998244353, N = 212;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 300;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = acos(-1);
const ll INF = 1e18;

int h, w, k, l[N << 1], r[N << 1], L, R;
vi gl[N << 1] , gr[N << 1], tmp;


bool in (int x, int y) {
	return x >= 0 && y >= 0 && x < h && y < w;
}

int f (int k) {
    vi vl, vr;
    vl.pb(L);
    vr.pb(R);

	for (int i = 0; i + k <= h + w - 2; ++i) {
		tmp.clear();
		for (int j = i; j <= i + k; ++j)
			tmp.pb(l[j]);
		int X = add_xor(tmp), O = add_or(tmp);
		vl.pb(add_xor({X, O}));

		tmp.clear();
		for (int j = i; j <= i + k; ++j)
			tmp.pb(r[j]);
		X = add_xor(tmp), O = add_or(tmp);
		vr.pb(add_xor({X, O}));
	}	

	return add_and({add_or(vl), add_or(vr)});
}

void construct_network(int H, int W, int K) {
	h = H, w = W, k = K;
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			gl[i + j].pb(i*w + j);   
			gr[i - j + w - 1].pb(i*w + j);
		}
 	
	vi vl, vr;
	for (int i = 0; i <= h + w - 2; ++i) {
		l[i] = add_or(gl[i]);
		r[i] = add_or(gr[i]);
		vl.pb(l[i]);
		vr.pb(r[i]);
	} 	    	

	L = add_xor(vl);
	R = add_xor(vr);
	
	vi V;
	V.pb(f(k));
	if (k > 1)
		V.pb(f(k - 1));
	add_xor(V);	
}
                    	
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 288 KB Output is correct
28 Correct 2 ms 512 KB Output is correct
29 Correct 1 ms 512 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 2 ms 416 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 288 KB Output is correct
28 Correct 2 ms 512 KB Output is correct
29 Correct 1 ms 512 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 2 ms 416 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
38 Correct 11 ms 1408 KB Output is correct
39 Correct 3 ms 512 KB Output is correct
40 Correct 3 ms 512 KB Output is correct
41 Correct 4 ms 896 KB Output is correct
42 Correct 3 ms 640 KB Output is correct
43 Correct 5 ms 896 KB Output is correct
44 Correct 12 ms 1408 KB Output is correct
45 Correct 13 ms 1536 KB Output is correct
46 Correct 10 ms 1280 KB Output is correct
47 Correct 4 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 10 ms 1280 KB Output is correct
3 Correct 10 ms 1152 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 9 ms 1024 KB Output is correct
7 Correct 9 ms 1024 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 8 ms 1024 KB Output is correct
11 Correct 10 ms 1152 KB Output is correct
12 Correct 10 ms 1152 KB Output is correct
13 Correct 8 ms 896 KB Output is correct
14 Correct 1 ms 512 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 9 ms 1024 KB Output is correct
17 Correct 10 ms 1152 KB Output is correct
18 Correct 10 ms 1280 KB Output is correct
19 Correct 8 ms 896 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 288 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 6 ms 768 KB Output is correct
6 Correct 5 ms 640 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 8 ms 1024 KB Output is correct
10 Correct 10 ms 1152 KB Output is correct
11 Correct 8 ms 1024 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 2 ms 512 KB Output is correct
14 Correct 9 ms 1152 KB Output is correct
15 Correct 8 ms 1024 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 10 ms 1152 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 7 ms 1152 KB Output is correct
21 Correct 25 ms 2688 KB Output is correct
22 Correct 24 ms 2688 KB Output is correct
23 Correct 9 ms 1024 KB Output is correct
24 Correct 7 ms 1152 KB Output is correct
25 Correct 27 ms 2944 KB Output is correct
26 Correct 7 ms 1024 KB Output is correct
27 Correct 13 ms 1920 KB Output is correct
28 Correct 40 ms 4212 KB Output is correct
29 Correct 48 ms 4984 KB Output is correct
30 Correct 39 ms 4088 KB Output is correct
31 Correct 13 ms 1664 KB Output is correct
32 Correct 1 ms 512 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1920 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 3 ms 768 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 7 ms 1152 KB Output is correct
8 Correct 7 ms 1152 KB Output is correct
9 Correct 13 ms 1920 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 512 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 288 KB Output is correct
28 Correct 2 ms 512 KB Output is correct
29 Correct 1 ms 512 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 2 ms 416 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 512 KB Output is correct
38 Correct 11 ms 1408 KB Output is correct
39 Correct 3 ms 512 KB Output is correct
40 Correct 3 ms 512 KB Output is correct
41 Correct 4 ms 896 KB Output is correct
42 Correct 3 ms 640 KB Output is correct
43 Correct 5 ms 896 KB Output is correct
44 Correct 12 ms 1408 KB Output is correct
45 Correct 13 ms 1536 KB Output is correct
46 Correct 10 ms 1280 KB Output is correct
47 Correct 4 ms 640 KB Output is correct
48 Correct 2 ms 512 KB Output is correct
49 Correct 10 ms 1280 KB Output is correct
50 Correct 10 ms 1152 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 2 ms 640 KB Output is correct
53 Correct 9 ms 1024 KB Output is correct
54 Correct 9 ms 1024 KB Output is correct
55 Correct 1 ms 384 KB Output is correct
56 Correct 2 ms 512 KB Output is correct
57 Correct 8 ms 1024 KB Output is correct
58 Correct 10 ms 1152 KB Output is correct
59 Correct 10 ms 1152 KB Output is correct
60 Correct 8 ms 896 KB Output is correct
61 Correct 1 ms 512 KB Output is correct
62 Correct 2 ms 640 KB Output is correct
63 Correct 9 ms 1024 KB Output is correct
64 Correct 10 ms 1152 KB Output is correct
65 Correct 10 ms 1280 KB Output is correct
66 Correct 8 ms 896 KB Output is correct
67 Correct 1 ms 384 KB Output is correct
68 Correct 1 ms 288 KB Output is correct
69 Correct 1 ms 384 KB Output is correct
70 Correct 1 ms 384 KB Output is correct
71 Correct 1 ms 512 KB Output is correct
72 Correct 2 ms 512 KB Output is correct
73 Correct 5 ms 896 KB Output is correct
74 Correct 6 ms 768 KB Output is correct
75 Correct 5 ms 640 KB Output is correct
76 Correct 2 ms 512 KB Output is correct
77 Correct 3 ms 640 KB Output is correct
78 Correct 8 ms 1024 KB Output is correct
79 Correct 10 ms 1152 KB Output is correct
80 Correct 8 ms 1024 KB Output is correct
81 Correct 3 ms 512 KB Output is correct
82 Correct 2 ms 512 KB Output is correct
83 Correct 9 ms 1152 KB Output is correct
84 Correct 8 ms 1024 KB Output is correct
85 Correct 1 ms 384 KB Output is correct
86 Correct 2 ms 512 KB Output is correct
87 Correct 10 ms 1152 KB Output is correct
88 Correct 1 ms 384 KB Output is correct
89 Correct 7 ms 1152 KB Output is correct
90 Correct 25 ms 2688 KB Output is correct
91 Correct 24 ms 2688 KB Output is correct
92 Correct 9 ms 1024 KB Output is correct
93 Correct 7 ms 1152 KB Output is correct
94 Correct 27 ms 2944 KB Output is correct
95 Correct 7 ms 1024 KB Output is correct
96 Correct 13 ms 1920 KB Output is correct
97 Correct 40 ms 4212 KB Output is correct
98 Correct 48 ms 4984 KB Output is correct
99 Correct 39 ms 4088 KB Output is correct
100 Correct 13 ms 1664 KB Output is correct
101 Correct 1 ms 512 KB Output is correct
102 Correct 1 ms 384 KB Output is correct
103 Correct 13 ms 1920 KB Output is correct
104 Correct 1 ms 384 KB Output is correct
105 Correct 2 ms 512 KB Output is correct
106 Correct 3 ms 768 KB Output is correct
107 Correct 2 ms 512 KB Output is correct
108 Correct 2 ms 512 KB Output is correct
109 Correct 7 ms 1152 KB Output is correct
110 Correct 7 ms 1152 KB Output is correct
111 Correct 13 ms 1920 KB Output is correct
112 Correct 1 ms 384 KB Output is correct
113 Correct 1 ms 384 KB Output is correct
114 Correct 41 ms 4212 KB Output is correct
115 Correct 1 ms 384 KB Output is correct
116 Correct 2 ms 768 KB Output is correct
117 Correct 19 ms 2048 KB Output is correct
118 Correct 19 ms 2176 KB Output is correct
119 Correct 47 ms 4984 KB Output is correct
120 Correct 48 ms 4984 KB Output is correct
121 Correct 49 ms 4984 KB Output is correct
122 Correct 48 ms 4984 KB Output is correct
123 Correct 13 ms 1920 KB Output is correct
124 Correct 42 ms 4348 KB Output is correct
125 Correct 48 ms 5056 KB Output is correct
126 Correct 51 ms 4984 KB Output is correct
127 Correct 38 ms 4088 KB Output is correct
128 Correct 12 ms 1664 KB Output is correct