#include "vision.h"
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x) cerr<< #x <<" = "<< x<<endl;
#define debug2(x,y) cerr<< #x <<" = "<< x<<" "<< #y <<" = "<< y<<endl;
using namespace std;
int _add(int x,int y){
vector<int>v;
v.pb(x);v.pb(y);
return add_and(v);
}
int _or(int x,int y){
vector<int>v;
v.pb(x);v.pb(y);
return add_or(v);
}
int _xor(int x,int y){
vector<int>v;
v.pb(x);v.pb(y);
return add_xor(v);
}
int n,m;
const int N=202;
vector<int>adj[2*N];
int res_or[2*N],res_xor[2*N];
int solve(int t,int dis){
if(!t){
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
adj[i+j].pb(i*m+j);
}
else{
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
adj[i-j+N].pb(i*m+j);
}
vector<int>ans;
int l=-1,r;
for(int i=0;i<2*N;i++){
if(adj[i].size()){
if(l==-1)
l=i;
r=i;
res_or[i]=add_or(adj[i]);
res_xor[i]=add_xor(adj[i]);
}
adj[i].clear();
}
for(int i=l;i<=r;i++){
int val=add_not(_xor(res_or[i],res_xor[i]));
vector<int>tmp;
for(int j=max(l,i-dis);j<=min(r,i+dis);j++)
if(i!=j)
tmp.pb(res_or[j]);
vector<int>aa;
if(tmp.size())
aa.pb(add_not(add_or(tmp)));
aa.pb(res_or[i]);aa.pb(val);
ans.pb(add_and(aa));
}
return add_or(ans);
}
void construct_network(int H, int W, int K) {n=H;m=W;
_xor(_or(solve(0,K),solve(1,K)),_or(solve(0,K-1),solve(1,K-1)));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
372 KB |
Output is correct |
14 |
Correct |
2 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
372 KB |
Output is correct |
14 |
Correct |
2 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
3 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
380 KB |
Output is correct |
24 |
Correct |
3 ms |
380 KB |
Output is correct |
25 |
Correct |
4 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
372 KB |
Output is correct |
14 |
Correct |
2 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
3 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
380 KB |
Output is correct |
24 |
Correct |
3 ms |
380 KB |
Output is correct |
25 |
Correct |
4 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
5 ms |
632 KB |
Output is correct |
29 |
Correct |
3 ms |
376 KB |
Output is correct |
30 |
Correct |
3 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
504 KB |
Output is correct |
32 |
Correct |
4 ms |
508 KB |
Output is correct |
33 |
Correct |
4 ms |
504 KB |
Output is correct |
34 |
Correct |
4 ms |
504 KB |
Output is correct |
35 |
Correct |
5 ms |
632 KB |
Output is correct |
36 |
Correct |
5 ms |
632 KB |
Output is correct |
37 |
Correct |
5 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
372 KB |
Output is correct |
14 |
Correct |
2 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
3 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
380 KB |
Output is correct |
24 |
Correct |
3 ms |
380 KB |
Output is correct |
25 |
Correct |
4 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
5 ms |
632 KB |
Output is correct |
29 |
Correct |
3 ms |
376 KB |
Output is correct |
30 |
Correct |
3 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
504 KB |
Output is correct |
32 |
Correct |
4 ms |
508 KB |
Output is correct |
33 |
Correct |
4 ms |
504 KB |
Output is correct |
34 |
Correct |
4 ms |
504 KB |
Output is correct |
35 |
Correct |
5 ms |
632 KB |
Output is correct |
36 |
Correct |
5 ms |
632 KB |
Output is correct |
37 |
Correct |
5 ms |
632 KB |
Output is correct |
38 |
Correct |
21 ms |
2164 KB |
Output is correct |
39 |
Correct |
5 ms |
760 KB |
Output is correct |
40 |
Correct |
7 ms |
888 KB |
Output is correct |
41 |
Correct |
8 ms |
1008 KB |
Output is correct |
42 |
Correct |
17 ms |
1780 KB |
Output is correct |
43 |
Correct |
13 ms |
1472 KB |
Output is correct |
44 |
Correct |
21 ms |
2164 KB |
Output is correct |
45 |
Correct |
29 ms |
2676 KB |
Output is correct |
46 |
Correct |
29 ms |
2932 KB |
Output is correct |
47 |
Correct |
31 ms |
3060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
760 KB |
Output is correct |
2 |
Correct |
18 ms |
1908 KB |
Output is correct |
3 |
Correct |
18 ms |
1780 KB |
Output is correct |
4 |
Correct |
23 ms |
2036 KB |
Output is correct |
5 |
Correct |
5 ms |
764 KB |
Output is correct |
6 |
Correct |
15 ms |
1524 KB |
Output is correct |
7 |
Correct |
19 ms |
2036 KB |
Output is correct |
8 |
Correct |
21 ms |
2036 KB |
Output is correct |
9 |
Correct |
5 ms |
760 KB |
Output is correct |
10 |
Correct |
12 ms |
1272 KB |
Output is correct |
11 |
Correct |
17 ms |
1780 KB |
Output is correct |
12 |
Correct |
17 ms |
1780 KB |
Output is correct |
13 |
Correct |
20 ms |
2036 KB |
Output is correct |
14 |
Correct |
21 ms |
2164 KB |
Output is correct |
15 |
Correct |
5 ms |
760 KB |
Output is correct |
16 |
Correct |
14 ms |
1396 KB |
Output is correct |
17 |
Correct |
17 ms |
1780 KB |
Output is correct |
18 |
Correct |
19 ms |
1780 KB |
Output is correct |
19 |
Correct |
20 ms |
2036 KB |
Output is correct |
20 |
Correct |
21 ms |
2164 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
760 KB |
Output is correct |
4 |
Correct |
9 ms |
1016 KB |
Output is correct |
5 |
Correct |
11 ms |
1272 KB |
Output is correct |
6 |
Correct |
12 ms |
1400 KB |
Output is correct |
7 |
Correct |
13 ms |
1400 KB |
Output is correct |
8 |
Correct |
9 ms |
1140 KB |
Output is correct |
9 |
Correct |
16 ms |
1780 KB |
Output is correct |
10 |
Correct |
19 ms |
2040 KB |
Output is correct |
11 |
Correct |
22 ms |
2160 KB |
Output is correct |
12 |
Correct |
22 ms |
2292 KB |
Output is correct |
13 |
Correct |
5 ms |
760 KB |
Output is correct |
14 |
Correct |
14 ms |
1524 KB |
Output is correct |
15 |
Correct |
19 ms |
2040 KB |
Output is correct |
16 |
Correct |
20 ms |
2036 KB |
Output is correct |
17 |
Correct |
5 ms |
760 KB |
Output is correct |
18 |
Correct |
17 ms |
1784 KB |
Output is correct |
19 |
Correct |
21 ms |
2164 KB |
Output is correct |
20 |
Correct |
23 ms |
2552 KB |
Output is correct |
21 |
Correct |
44 ms |
4460 KB |
Output is correct |
22 |
Correct |
56 ms |
5744 KB |
Output is correct |
23 |
Correct |
61 ms |
6128 KB |
Output is correct |
24 |
Correct |
22 ms |
2420 KB |
Output is correct |
25 |
Correct |
52 ms |
5236 KB |
Output is correct |
26 |
Correct |
59 ms |
6000 KB |
Output is correct |
27 |
Correct |
40 ms |
4336 KB |
Output is correct |
28 |
Incorrect |
10 ms |
3312 KB |
WA in grader: Too many instructions |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
4340 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
760 KB |
Output is correct |
4 |
Correct |
10 ms |
1144 KB |
Output is correct |
5 |
Correct |
5 ms |
760 KB |
Output is correct |
6 |
Correct |
6 ms |
760 KB |
Output is correct |
7 |
Correct |
22 ms |
2552 KB |
Output is correct |
8 |
Correct |
22 ms |
2420 KB |
Output is correct |
9 |
Correct |
39 ms |
4336 KB |
Output is correct |
10 |
Correct |
2 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
372 KB |
Output is correct |
14 |
Correct |
2 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
2 ms |
256 KB |
Output is correct |
19 |
Correct |
3 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
3 ms |
376 KB |
Output is correct |
23 |
Correct |
2 ms |
380 KB |
Output is correct |
24 |
Correct |
3 ms |
380 KB |
Output is correct |
25 |
Correct |
4 ms |
376 KB |
Output is correct |
26 |
Correct |
2 ms |
376 KB |
Output is correct |
27 |
Correct |
2 ms |
376 KB |
Output is correct |
28 |
Correct |
5 ms |
632 KB |
Output is correct |
29 |
Correct |
3 ms |
376 KB |
Output is correct |
30 |
Correct |
3 ms |
376 KB |
Output is correct |
31 |
Correct |
4 ms |
504 KB |
Output is correct |
32 |
Correct |
4 ms |
508 KB |
Output is correct |
33 |
Correct |
4 ms |
504 KB |
Output is correct |
34 |
Correct |
4 ms |
504 KB |
Output is correct |
35 |
Correct |
5 ms |
632 KB |
Output is correct |
36 |
Correct |
5 ms |
632 KB |
Output is correct |
37 |
Correct |
5 ms |
632 KB |
Output is correct |
38 |
Correct |
21 ms |
2164 KB |
Output is correct |
39 |
Correct |
5 ms |
760 KB |
Output is correct |
40 |
Correct |
7 ms |
888 KB |
Output is correct |
41 |
Correct |
8 ms |
1008 KB |
Output is correct |
42 |
Correct |
17 ms |
1780 KB |
Output is correct |
43 |
Correct |
13 ms |
1472 KB |
Output is correct |
44 |
Correct |
21 ms |
2164 KB |
Output is correct |
45 |
Correct |
29 ms |
2676 KB |
Output is correct |
46 |
Correct |
29 ms |
2932 KB |
Output is correct |
47 |
Correct |
31 ms |
3060 KB |
Output is correct |
48 |
Correct |
5 ms |
760 KB |
Output is correct |
49 |
Correct |
18 ms |
1908 KB |
Output is correct |
50 |
Correct |
18 ms |
1780 KB |
Output is correct |
51 |
Correct |
23 ms |
2036 KB |
Output is correct |
52 |
Correct |
5 ms |
764 KB |
Output is correct |
53 |
Correct |
15 ms |
1524 KB |
Output is correct |
54 |
Correct |
19 ms |
2036 KB |
Output is correct |
55 |
Correct |
21 ms |
2036 KB |
Output is correct |
56 |
Correct |
5 ms |
760 KB |
Output is correct |
57 |
Correct |
12 ms |
1272 KB |
Output is correct |
58 |
Correct |
17 ms |
1780 KB |
Output is correct |
59 |
Correct |
17 ms |
1780 KB |
Output is correct |
60 |
Correct |
20 ms |
2036 KB |
Output is correct |
61 |
Correct |
21 ms |
2164 KB |
Output is correct |
62 |
Correct |
5 ms |
760 KB |
Output is correct |
63 |
Correct |
14 ms |
1396 KB |
Output is correct |
64 |
Correct |
17 ms |
1780 KB |
Output is correct |
65 |
Correct |
19 ms |
1780 KB |
Output is correct |
66 |
Correct |
20 ms |
2036 KB |
Output is correct |
67 |
Correct |
21 ms |
2164 KB |
Output is correct |
68 |
Correct |
2 ms |
376 KB |
Output is correct |
69 |
Correct |
2 ms |
256 KB |
Output is correct |
70 |
Correct |
2 ms |
504 KB |
Output is correct |
71 |
Correct |
2 ms |
376 KB |
Output is correct |
72 |
Correct |
6 ms |
760 KB |
Output is correct |
73 |
Correct |
9 ms |
1016 KB |
Output is correct |
74 |
Correct |
11 ms |
1272 KB |
Output is correct |
75 |
Correct |
12 ms |
1400 KB |
Output is correct |
76 |
Correct |
13 ms |
1400 KB |
Output is correct |
77 |
Correct |
9 ms |
1140 KB |
Output is correct |
78 |
Correct |
16 ms |
1780 KB |
Output is correct |
79 |
Correct |
19 ms |
2040 KB |
Output is correct |
80 |
Correct |
22 ms |
2160 KB |
Output is correct |
81 |
Correct |
22 ms |
2292 KB |
Output is correct |
82 |
Correct |
5 ms |
760 KB |
Output is correct |
83 |
Correct |
14 ms |
1524 KB |
Output is correct |
84 |
Correct |
19 ms |
2040 KB |
Output is correct |
85 |
Correct |
20 ms |
2036 KB |
Output is correct |
86 |
Correct |
5 ms |
760 KB |
Output is correct |
87 |
Correct |
17 ms |
1784 KB |
Output is correct |
88 |
Correct |
21 ms |
2164 KB |
Output is correct |
89 |
Correct |
23 ms |
2552 KB |
Output is correct |
90 |
Correct |
44 ms |
4460 KB |
Output is correct |
91 |
Correct |
56 ms |
5744 KB |
Output is correct |
92 |
Correct |
61 ms |
6128 KB |
Output is correct |
93 |
Correct |
22 ms |
2420 KB |
Output is correct |
94 |
Correct |
52 ms |
5236 KB |
Output is correct |
95 |
Correct |
59 ms |
6000 KB |
Output is correct |
96 |
Correct |
40 ms |
4336 KB |
Output is correct |
97 |
Incorrect |
10 ms |
3312 KB |
WA in grader: Too many instructions |
98 |
Halted |
0 ms |
0 KB |
- |