Submission #602854

# Submission time Handle Problem Language Result Execution time Memory
602854 2022-07-23T11:49:29 Z Koosha_mv Vision Program (IOI19_vision) C++14
100 / 100
51 ms 4516 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,int(v.size())) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first

const int N=222,lg=12;

int n,m,k,row[N],col[N],a[N][N],R[lg],C[lg],res[lg],prt[N];

void construct_network(int _n, int _m, int _k){
	n=_n,m=_m,k=_k;
	int z=0;
	f(i,0,n){
		f(j,0,m){
			a[i][j]=z++;
		}
	}
	f(i,0,n){
		vector<int> vec;
		f(j,0,m) vec.pb(a[i][j]);
		row[i]=add_or(vec);
	}
	f(j,0,m){
		vector<int> vec;
		f(i,0,n) vec.pb(a[i][j]);
		col[j]=add_or(vec);
	}
	f(l,0,lg){
		f(i,0,n){
			vector<int> vec;
			f(j,0,n){
				if(bit(abs(i-j),l)){
					vec.pb(row[j]);
				}
			}
			if(vec.size()){
				prt[i]=add_and({row[i],add_or(vec)});
			}
			else{
				prt[i]=add_xor({0,0});
			}
		}
		vector<int> p;
		f(i,0,n) p.pb(prt[i]);
		R[l]=add_or(p);
	}
	f(l,0,lg){
		f(i,0,m){
			vector<int> vec;
			f(j,0,m){
				if(bit(abs(i-j),l)){
					vec.pb(col[j]);
				}
			}
			if(vec.size()){
				prt[i]=add_and({col[i],add_or(vec)});
			}
			else{
				prt[i]=add_xor({0,0});
			}		
		}
		vector<int> p;
		f(i,0,m) p.pb(prt[i]);
		C[l]=add_or(p);
	}
	//f(l,0,lg) add_or({R[l]});
	//return ;
	int now=add_xor({0,0});
	f(l,0,lg){
		res[l]=add_xor({now,R[l],C[l]});
		now=add_or({now,add_and({R[l],C[l]})});
		now=add_and({now,add_or({R[l],C[l]})});
	}
	vector<int> vec;
	f(l,0,lg){
		if(bit(k,l)==1){
			vec.pb(res[l]);
		}
		else{
			vec.pb(add_not(res[l]));
		}
	}
	add_and(vec);
}
/*
2 2 2
0 0 1 1
1
-1
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 304 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 304 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 304 KB Output is correct
28 Correct 2 ms 432 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 2 ms 436 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 304 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 304 KB Output is correct
28 Correct 2 ms 432 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 2 ms 436 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 14 ms 1336 KB Output is correct
39 Correct 5 ms 724 KB Output is correct
40 Correct 5 ms 820 KB Output is correct
41 Correct 6 ms 964 KB Output is correct
42 Correct 6 ms 944 KB Output is correct
43 Correct 10 ms 1412 KB Output is correct
44 Correct 10 ms 1320 KB Output is correct
45 Correct 10 ms 1380 KB Output is correct
46 Correct 9 ms 1396 KB Output is correct
47 Correct 9 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1616 KB Output is correct
2 Correct 16 ms 1672 KB Output is correct
3 Correct 15 ms 1552 KB Output is correct
4 Correct 19 ms 1644 KB Output is correct
5 Correct 15 ms 1788 KB Output is correct
6 Correct 14 ms 1948 KB Output is correct
7 Correct 15 ms 1736 KB Output is correct
8 Correct 20 ms 1744 KB Output is correct
9 Correct 14 ms 1592 KB Output is correct
10 Correct 14 ms 1636 KB Output is correct
11 Correct 15 ms 1616 KB Output is correct
12 Correct 15 ms 1692 KB Output is correct
13 Correct 15 ms 1636 KB Output is correct
14 Correct 17 ms 1616 KB Output is correct
15 Correct 16 ms 1728 KB Output is correct
16 Correct 16 ms 1840 KB Output is correct
17 Correct 15 ms 1744 KB Output is correct
18 Correct 14 ms 1872 KB Output is correct
19 Correct 17 ms 1840 KB Output is correct
20 Correct 17 ms 1744 KB Output is correct
21 Correct 1 ms 304 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 5 ms 852 KB Output is correct
4 Correct 5 ms 852 KB Output is correct
5 Correct 5 ms 948 KB Output is correct
6 Correct 5 ms 852 KB Output is correct
7 Correct 5 ms 884 KB Output is correct
8 Correct 9 ms 1204 KB Output is correct
9 Correct 10 ms 1204 KB Output is correct
10 Correct 12 ms 1244 KB Output is correct
11 Correct 13 ms 1236 KB Output is correct
12 Correct 10 ms 1236 KB Output is correct
13 Correct 16 ms 1640 KB Output is correct
14 Correct 22 ms 1612 KB Output is correct
15 Correct 14 ms 1588 KB Output is correct
16 Correct 14 ms 1616 KB Output is correct
17 Correct 20 ms 1840 KB Output is correct
18 Correct 15 ms 1836 KB Output is correct
19 Correct 16 ms 1864 KB Output is correct
20 Correct 22 ms 2880 KB Output is correct
21 Correct 23 ms 2848 KB Output is correct
22 Correct 22 ms 2804 KB Output is correct
23 Correct 23 ms 2888 KB Output is correct
24 Correct 28 ms 2784 KB Output is correct
25 Correct 23 ms 2784 KB Output is correct
26 Correct 22 ms 2768 KB Output is correct
27 Correct 36 ms 4416 KB Output is correct
28 Correct 37 ms 4504 KB Output is correct
29 Correct 39 ms 4488 KB Output is correct
30 Correct 41 ms 4488 KB Output is correct
31 Correct 40 ms 4516 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 4448 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 5 ms 948 KB Output is correct
4 Correct 8 ms 1236 KB Output is correct
5 Correct 14 ms 1616 KB Output is correct
6 Correct 20 ms 1760 KB Output is correct
7 Correct 29 ms 2908 KB Output is correct
8 Correct 23 ms 2768 KB Output is correct
9 Correct 36 ms 4444 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 304 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 308 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 304 KB Output is correct
28 Correct 2 ms 432 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 2 ms 436 KB Output is correct
34 Correct 2 ms 468 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 468 KB Output is correct
38 Correct 14 ms 1336 KB Output is correct
39 Correct 5 ms 724 KB Output is correct
40 Correct 5 ms 820 KB Output is correct
41 Correct 6 ms 964 KB Output is correct
42 Correct 6 ms 944 KB Output is correct
43 Correct 10 ms 1412 KB Output is correct
44 Correct 10 ms 1320 KB Output is correct
45 Correct 10 ms 1380 KB Output is correct
46 Correct 9 ms 1396 KB Output is correct
47 Correct 9 ms 1364 KB Output is correct
48 Correct 14 ms 1616 KB Output is correct
49 Correct 16 ms 1672 KB Output is correct
50 Correct 15 ms 1552 KB Output is correct
51 Correct 19 ms 1644 KB Output is correct
52 Correct 15 ms 1788 KB Output is correct
53 Correct 14 ms 1948 KB Output is correct
54 Correct 15 ms 1736 KB Output is correct
55 Correct 20 ms 1744 KB Output is correct
56 Correct 14 ms 1592 KB Output is correct
57 Correct 14 ms 1636 KB Output is correct
58 Correct 15 ms 1616 KB Output is correct
59 Correct 15 ms 1692 KB Output is correct
60 Correct 15 ms 1636 KB Output is correct
61 Correct 17 ms 1616 KB Output is correct
62 Correct 16 ms 1728 KB Output is correct
63 Correct 16 ms 1840 KB Output is correct
64 Correct 15 ms 1744 KB Output is correct
65 Correct 14 ms 1872 KB Output is correct
66 Correct 17 ms 1840 KB Output is correct
67 Correct 17 ms 1744 KB Output is correct
68 Correct 1 ms 304 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 5 ms 852 KB Output is correct
73 Correct 5 ms 852 KB Output is correct
74 Correct 5 ms 948 KB Output is correct
75 Correct 5 ms 852 KB Output is correct
76 Correct 5 ms 884 KB Output is correct
77 Correct 9 ms 1204 KB Output is correct
78 Correct 10 ms 1204 KB Output is correct
79 Correct 12 ms 1244 KB Output is correct
80 Correct 13 ms 1236 KB Output is correct
81 Correct 10 ms 1236 KB Output is correct
82 Correct 16 ms 1640 KB Output is correct
83 Correct 22 ms 1612 KB Output is correct
84 Correct 14 ms 1588 KB Output is correct
85 Correct 14 ms 1616 KB Output is correct
86 Correct 20 ms 1840 KB Output is correct
87 Correct 15 ms 1836 KB Output is correct
88 Correct 16 ms 1864 KB Output is correct
89 Correct 22 ms 2880 KB Output is correct
90 Correct 23 ms 2848 KB Output is correct
91 Correct 22 ms 2804 KB Output is correct
92 Correct 23 ms 2888 KB Output is correct
93 Correct 28 ms 2784 KB Output is correct
94 Correct 23 ms 2784 KB Output is correct
95 Correct 22 ms 2768 KB Output is correct
96 Correct 36 ms 4416 KB Output is correct
97 Correct 37 ms 4504 KB Output is correct
98 Correct 39 ms 4488 KB Output is correct
99 Correct 41 ms 4488 KB Output is correct
100 Correct 40 ms 4516 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 1 ms 312 KB Output is correct
103 Correct 38 ms 4448 KB Output is correct
104 Correct 1 ms 304 KB Output is correct
105 Correct 5 ms 948 KB Output is correct
106 Correct 8 ms 1236 KB Output is correct
107 Correct 14 ms 1616 KB Output is correct
108 Correct 20 ms 1760 KB Output is correct
109 Correct 29 ms 2908 KB Output is correct
110 Correct 23 ms 2768 KB Output is correct
111 Correct 36 ms 4444 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 308 KB Output is correct
114 Correct 37 ms 4396 KB Output is correct
115 Correct 16 ms 1616 KB Output is correct
116 Correct 16 ms 1728 KB Output is correct
117 Correct 21 ms 2836 KB Output is correct
118 Correct 22 ms 2740 KB Output is correct
119 Correct 35 ms 4416 KB Output is correct
120 Correct 36 ms 4420 KB Output is correct
121 Correct 39 ms 4428 KB Output is correct
122 Correct 43 ms 4420 KB Output is correct
123 Correct 40 ms 4452 KB Output is correct
124 Correct 36 ms 4388 KB Output is correct
125 Correct 40 ms 4420 KB Output is correct
126 Correct 51 ms 4468 KB Output is correct
127 Correct 41 ms 4468 KB Output is correct
128 Correct 36 ms 4420 KB Output is correct