#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(n) for (int i=0; i<n; i++)
#define jrep(n) for (int j=0; j<n; j++)
const int c=402, f=399;
int pos, os[c], osk[c], oseg[c], kul[c], kulk[c], kseg[c], eos, ekul, van, s, nincs, rossz, db, p;
vector<int> sol;
void pb(int a) {
sol.push_back(a);
}
int add(int a) {
pos++;
if (sol.size()==0) sol.push_back(rossz);
if (a==1) add_or(sol);
if (a==2) add_and(sol);
if (a==3) add_xor(sol);
if (a==4) add_not(p);
sol.clear();
return pos;
}
int solve(int k) {
rep(f-k) {
pb(eos), pb(osk[i]), pb(osk[i+k]);
oseg[i]=add(2);
pb(ekul), pb(kulk[i]), pb(kulk[i+k]);
kseg[i]=add(2);
}
rep(f-k) pb(oseg[i]);
oseg[0]=add(1);
rep(f-k) pb(kseg[i]);
kseg[0]=add(1);
pb(oseg[0]), pb(kseg[0]);
return add(1);
}
void construct_network(int n, int m, int k) {
pos=n*m-1, db=n*m;
rep(db) pb(i);
rossz=add(3);
rep(f) {
int ert=i;
rep(db) {
int x=i/m, y=i%m;
if (x+199-y==ert) pb(i);
}
kul[ert]=add(1);
rep(db) {
int x=i/m, y=i%m;
if (x+y==ert) pb(i);
}
os[ert]=add(1);
if (!i) kulk[i]=kul[i], osk[i]=os[i];
else {
pb(kulk[i-1]), pb(kul[i]);
kulk[i]=add(3);
pb(osk[i-1]), pb(os[i]);
osk[i]=add(3);
}
}
p=kulk[f-1], ekul=add(4);
p=osk[f-1], eos=add(4);
nincs=solve(k-1), van=solve(k);
pb(van), pb(nincs);
add(3);
}
/*
int main()
{
return 0;
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
3 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
640 KB |
Output is correct |
15 |
Correct |
3 ms |
640 KB |
Output is correct |
16 |
Correct |
3 ms |
640 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
3 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
640 KB |
Output is correct |
15 |
Correct |
3 ms |
640 KB |
Output is correct |
16 |
Correct |
3 ms |
640 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Correct |
3 ms |
640 KB |
Output is correct |
19 |
Correct |
3 ms |
640 KB |
Output is correct |
20 |
Correct |
3 ms |
640 KB |
Output is correct |
21 |
Correct |
3 ms |
640 KB |
Output is correct |
22 |
Correct |
3 ms |
640 KB |
Output is correct |
23 |
Correct |
3 ms |
640 KB |
Output is correct |
24 |
Correct |
3 ms |
640 KB |
Output is correct |
25 |
Correct |
3 ms |
640 KB |
Output is correct |
26 |
Correct |
3 ms |
640 KB |
Output is correct |
27 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
3 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
640 KB |
Output is correct |
15 |
Correct |
3 ms |
640 KB |
Output is correct |
16 |
Correct |
3 ms |
640 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Correct |
3 ms |
640 KB |
Output is correct |
19 |
Correct |
3 ms |
640 KB |
Output is correct |
20 |
Correct |
3 ms |
640 KB |
Output is correct |
21 |
Correct |
3 ms |
640 KB |
Output is correct |
22 |
Correct |
3 ms |
640 KB |
Output is correct |
23 |
Correct |
3 ms |
640 KB |
Output is correct |
24 |
Correct |
3 ms |
640 KB |
Output is correct |
25 |
Correct |
3 ms |
640 KB |
Output is correct |
26 |
Correct |
3 ms |
640 KB |
Output is correct |
27 |
Correct |
3 ms |
640 KB |
Output is correct |
28 |
Correct |
7 ms |
640 KB |
Output is correct |
29 |
Correct |
3 ms |
640 KB |
Output is correct |
30 |
Correct |
3 ms |
640 KB |
Output is correct |
31 |
Correct |
5 ms |
640 KB |
Output is correct |
32 |
Correct |
5 ms |
640 KB |
Output is correct |
33 |
Correct |
8 ms |
672 KB |
Output is correct |
34 |
Correct |
7 ms |
640 KB |
Output is correct |
35 |
Correct |
8 ms |
640 KB |
Output is correct |
36 |
Correct |
8 ms |
640 KB |
Output is correct |
37 |
Correct |
8 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
3 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
640 KB |
Output is correct |
15 |
Correct |
3 ms |
640 KB |
Output is correct |
16 |
Correct |
3 ms |
640 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Correct |
3 ms |
640 KB |
Output is correct |
19 |
Correct |
3 ms |
640 KB |
Output is correct |
20 |
Correct |
3 ms |
640 KB |
Output is correct |
21 |
Correct |
3 ms |
640 KB |
Output is correct |
22 |
Correct |
3 ms |
640 KB |
Output is correct |
23 |
Correct |
3 ms |
640 KB |
Output is correct |
24 |
Correct |
3 ms |
640 KB |
Output is correct |
25 |
Correct |
3 ms |
640 KB |
Output is correct |
26 |
Correct |
3 ms |
640 KB |
Output is correct |
27 |
Correct |
3 ms |
640 KB |
Output is correct |
28 |
Correct |
7 ms |
640 KB |
Output is correct |
29 |
Correct |
3 ms |
640 KB |
Output is correct |
30 |
Correct |
3 ms |
640 KB |
Output is correct |
31 |
Correct |
5 ms |
640 KB |
Output is correct |
32 |
Correct |
5 ms |
640 KB |
Output is correct |
33 |
Correct |
8 ms |
672 KB |
Output is correct |
34 |
Correct |
7 ms |
640 KB |
Output is correct |
35 |
Correct |
8 ms |
640 KB |
Output is correct |
36 |
Correct |
8 ms |
640 KB |
Output is correct |
37 |
Correct |
8 ms |
640 KB |
Output is correct |
38 |
Correct |
55 ms |
888 KB |
Output is correct |
39 |
Correct |
3 ms |
640 KB |
Output is correct |
40 |
Correct |
4 ms |
640 KB |
Output is correct |
41 |
Correct |
31 ms |
768 KB |
Output is correct |
42 |
Correct |
29 ms |
760 KB |
Output is correct |
43 |
Correct |
55 ms |
888 KB |
Output is correct |
44 |
Correct |
55 ms |
888 KB |
Output is correct |
45 |
Correct |
55 ms |
888 KB |
Output is correct |
46 |
Correct |
57 ms |
1148 KB |
Output is correct |
47 |
Correct |
54 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
512 KB |
Output is correct |
5 |
Correct |
5 ms |
640 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
3 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
512 KB |
Output is correct |
9 |
Correct |
5 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
3 ms |
768 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
512 KB |
Output is correct |
15 |
Correct |
4 ms |
640 KB |
Output is correct |
16 |
Correct |
4 ms |
640 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Correct |
3 ms |
640 KB |
Output is correct |
19 |
Correct |
3 ms |
512 KB |
Output is correct |
20 |
Correct |
3 ms |
512 KB |
Output is correct |
21 |
Correct |
4 ms |
640 KB |
Output is correct |
22 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
18 ms |
640 KB |
Output is correct |
4 |
Correct |
18 ms |
640 KB |
Output is correct |
5 |
Correct |
19 ms |
640 KB |
Output is correct |
6 |
Correct |
18 ms |
640 KB |
Output is correct |
7 |
Correct |
18 ms |
640 KB |
Output is correct |
8 |
Correct |
32 ms |
760 KB |
Output is correct |
9 |
Correct |
33 ms |
888 KB |
Output is correct |
10 |
Correct |
32 ms |
760 KB |
Output is correct |
11 |
Correct |
34 ms |
760 KB |
Output is correct |
12 |
Correct |
32 ms |
764 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
640 KB |
Output is correct |
15 |
Correct |
3 ms |
600 KB |
Output is correct |
16 |
Correct |
3 ms |
512 KB |
Output is correct |
17 |
Correct |
4 ms |
640 KB |
Output is correct |
18 |
Correct |
4 ms |
640 KB |
Output is correct |
19 |
Correct |
3 ms |
512 KB |
Output is correct |
20 |
Correct |
110 ms |
1216 KB |
Output is correct |
21 |
Correct |
110 ms |
1272 KB |
Output is correct |
22 |
Correct |
110 ms |
1376 KB |
Output is correct |
23 |
Correct |
110 ms |
1144 KB |
Output is correct |
24 |
Correct |
108 ms |
1528 KB |
Output is correct |
25 |
Correct |
108 ms |
1272 KB |
Output is correct |
26 |
Correct |
108 ms |
1144 KB |
Output is correct |
27 |
Correct |
218 ms |
1876 KB |
Output is correct |
28 |
Correct |
218 ms |
1876 KB |
Output is correct |
29 |
Correct |
220 ms |
1876 KB |
Output is correct |
30 |
Correct |
218 ms |
1852 KB |
Output is correct |
31 |
Correct |
219 ms |
1748 KB |
Output is correct |
32 |
Correct |
3 ms |
640 KB |
Output is correct |
33 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
217 ms |
1872 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
19 ms |
640 KB |
Output is correct |
4 |
Correct |
33 ms |
768 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
4 ms |
640 KB |
Output is correct |
7 |
Correct |
110 ms |
1272 KB |
Output is correct |
8 |
Correct |
108 ms |
1272 KB |
Output is correct |
9 |
Correct |
218 ms |
2004 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
640 KB |
Output is correct |
6 |
Correct |
3 ms |
640 KB |
Output is correct |
7 |
Correct |
4 ms |
640 KB |
Output is correct |
8 |
Correct |
3 ms |
640 KB |
Output is correct |
9 |
Correct |
3 ms |
640 KB |
Output is correct |
10 |
Correct |
3 ms |
640 KB |
Output is correct |
11 |
Correct |
3 ms |
640 KB |
Output is correct |
12 |
Correct |
3 ms |
640 KB |
Output is correct |
13 |
Correct |
3 ms |
640 KB |
Output is correct |
14 |
Correct |
3 ms |
640 KB |
Output is correct |
15 |
Correct |
3 ms |
640 KB |
Output is correct |
16 |
Correct |
3 ms |
640 KB |
Output is correct |
17 |
Correct |
3 ms |
640 KB |
Output is correct |
18 |
Correct |
3 ms |
640 KB |
Output is correct |
19 |
Correct |
3 ms |
640 KB |
Output is correct |
20 |
Correct |
3 ms |
640 KB |
Output is correct |
21 |
Correct |
3 ms |
640 KB |
Output is correct |
22 |
Correct |
3 ms |
640 KB |
Output is correct |
23 |
Correct |
3 ms |
640 KB |
Output is correct |
24 |
Correct |
3 ms |
640 KB |
Output is correct |
25 |
Correct |
3 ms |
640 KB |
Output is correct |
26 |
Correct |
3 ms |
640 KB |
Output is correct |
27 |
Correct |
3 ms |
640 KB |
Output is correct |
28 |
Correct |
7 ms |
640 KB |
Output is correct |
29 |
Correct |
3 ms |
640 KB |
Output is correct |
30 |
Correct |
3 ms |
640 KB |
Output is correct |
31 |
Correct |
5 ms |
640 KB |
Output is correct |
32 |
Correct |
5 ms |
640 KB |
Output is correct |
33 |
Correct |
8 ms |
672 KB |
Output is correct |
34 |
Correct |
7 ms |
640 KB |
Output is correct |
35 |
Correct |
8 ms |
640 KB |
Output is correct |
36 |
Correct |
8 ms |
640 KB |
Output is correct |
37 |
Correct |
8 ms |
640 KB |
Output is correct |
38 |
Correct |
55 ms |
888 KB |
Output is correct |
39 |
Correct |
3 ms |
640 KB |
Output is correct |
40 |
Correct |
4 ms |
640 KB |
Output is correct |
41 |
Correct |
31 ms |
768 KB |
Output is correct |
42 |
Correct |
29 ms |
760 KB |
Output is correct |
43 |
Correct |
55 ms |
888 KB |
Output is correct |
44 |
Correct |
55 ms |
888 KB |
Output is correct |
45 |
Correct |
55 ms |
888 KB |
Output is correct |
46 |
Correct |
57 ms |
1148 KB |
Output is correct |
47 |
Correct |
54 ms |
888 KB |
Output is correct |
48 |
Correct |
3 ms |
640 KB |
Output is correct |
49 |
Correct |
3 ms |
640 KB |
Output is correct |
50 |
Correct |
3 ms |
640 KB |
Output is correct |
51 |
Correct |
3 ms |
512 KB |
Output is correct |
52 |
Correct |
5 ms |
640 KB |
Output is correct |
53 |
Correct |
3 ms |
640 KB |
Output is correct |
54 |
Correct |
3 ms |
640 KB |
Output is correct |
55 |
Correct |
3 ms |
512 KB |
Output is correct |
56 |
Correct |
5 ms |
640 KB |
Output is correct |
57 |
Correct |
3 ms |
640 KB |
Output is correct |
58 |
Correct |
3 ms |
640 KB |
Output is correct |
59 |
Correct |
3 ms |
768 KB |
Output is correct |
60 |
Correct |
3 ms |
640 KB |
Output is correct |
61 |
Correct |
3 ms |
512 KB |
Output is correct |
62 |
Correct |
4 ms |
640 KB |
Output is correct |
63 |
Correct |
4 ms |
640 KB |
Output is correct |
64 |
Correct |
3 ms |
640 KB |
Output is correct |
65 |
Correct |
3 ms |
640 KB |
Output is correct |
66 |
Correct |
3 ms |
512 KB |
Output is correct |
67 |
Correct |
3 ms |
512 KB |
Output is correct |
68 |
Correct |
4 ms |
640 KB |
Output is correct |
69 |
Correct |
3 ms |
640 KB |
Output is correct |
70 |
Correct |
3 ms |
640 KB |
Output is correct |
71 |
Correct |
3 ms |
640 KB |
Output is correct |
72 |
Correct |
18 ms |
640 KB |
Output is correct |
73 |
Correct |
18 ms |
640 KB |
Output is correct |
74 |
Correct |
19 ms |
640 KB |
Output is correct |
75 |
Correct |
18 ms |
640 KB |
Output is correct |
76 |
Correct |
18 ms |
640 KB |
Output is correct |
77 |
Correct |
32 ms |
760 KB |
Output is correct |
78 |
Correct |
33 ms |
888 KB |
Output is correct |
79 |
Correct |
32 ms |
760 KB |
Output is correct |
80 |
Correct |
34 ms |
760 KB |
Output is correct |
81 |
Correct |
32 ms |
764 KB |
Output is correct |
82 |
Correct |
3 ms |
640 KB |
Output is correct |
83 |
Correct |
3 ms |
640 KB |
Output is correct |
84 |
Correct |
3 ms |
600 KB |
Output is correct |
85 |
Correct |
3 ms |
512 KB |
Output is correct |
86 |
Correct |
4 ms |
640 KB |
Output is correct |
87 |
Correct |
4 ms |
640 KB |
Output is correct |
88 |
Correct |
3 ms |
512 KB |
Output is correct |
89 |
Correct |
110 ms |
1216 KB |
Output is correct |
90 |
Correct |
110 ms |
1272 KB |
Output is correct |
91 |
Correct |
110 ms |
1376 KB |
Output is correct |
92 |
Correct |
110 ms |
1144 KB |
Output is correct |
93 |
Correct |
108 ms |
1528 KB |
Output is correct |
94 |
Correct |
108 ms |
1272 KB |
Output is correct |
95 |
Correct |
108 ms |
1144 KB |
Output is correct |
96 |
Correct |
218 ms |
1876 KB |
Output is correct |
97 |
Correct |
218 ms |
1876 KB |
Output is correct |
98 |
Correct |
220 ms |
1876 KB |
Output is correct |
99 |
Correct |
218 ms |
1852 KB |
Output is correct |
100 |
Correct |
219 ms |
1748 KB |
Output is correct |
101 |
Correct |
3 ms |
640 KB |
Output is correct |
102 |
Correct |
3 ms |
640 KB |
Output is correct |
103 |
Correct |
217 ms |
1872 KB |
Output is correct |
104 |
Correct |
3 ms |
640 KB |
Output is correct |
105 |
Correct |
19 ms |
640 KB |
Output is correct |
106 |
Correct |
33 ms |
768 KB |
Output is correct |
107 |
Correct |
4 ms |
640 KB |
Output is correct |
108 |
Correct |
4 ms |
640 KB |
Output is correct |
109 |
Correct |
110 ms |
1272 KB |
Output is correct |
110 |
Correct |
108 ms |
1272 KB |
Output is correct |
111 |
Correct |
218 ms |
2004 KB |
Output is correct |
112 |
Correct |
3 ms |
640 KB |
Output is correct |
113 |
Correct |
3 ms |
640 KB |
Output is correct |
114 |
Correct |
218 ms |
1852 KB |
Output is correct |
115 |
Correct |
4 ms |
512 KB |
Output is correct |
116 |
Correct |
4 ms |
640 KB |
Output is correct |
117 |
Correct |
111 ms |
1144 KB |
Output is correct |
118 |
Correct |
114 ms |
1272 KB |
Output is correct |
119 |
Correct |
218 ms |
1872 KB |
Output is correct |
120 |
Correct |
217 ms |
2008 KB |
Output is correct |
121 |
Correct |
220 ms |
2008 KB |
Output is correct |
122 |
Correct |
217 ms |
1880 KB |
Output is correct |
123 |
Correct |
217 ms |
1876 KB |
Output is correct |
124 |
Correct |
219 ms |
1876 KB |
Output is correct |
125 |
Correct |
221 ms |
2004 KB |
Output is correct |
126 |
Correct |
218 ms |
1900 KB |
Output is correct |
127 |
Correct |
219 ms |
1812 KB |
Output is correct |
128 |
Correct |
218 ms |
1748 KB |
Output is correct |