#include "vision.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,m;
int qur;
vector < int > g;
map < int , pair < int , int > > ll , rr;
map < int , vector < int > > l,r;
int o_r( vector < int > v )
{
qur += 1;
add_or( v );
return qur;
}
int an_d( vector < int > v )
{
qur += 1;
add_and( v );
return qur;
}
int xo_r( vector < int > v )
{
qur += 1;
add_xor( v );
return qur;
}
int no_t( int x )
{
qur += 1;
add_not( x );
return qur;
}
int foo( int k )
{
vector < int > g,ff;
for( int i = -(n + m); i <= n + m; i++ ){
if( l[i].empty() )continue;
bool f = true;
vector < int > ask;
for( int j = i; j <= i + k; j++ ){
if( l[j].empty() ){
continue;
}
assert( ll.find(j) != ll.end() );
ask.push_back( ll[j].fi );
}
if( (int)ask.size() < 1 )continue;
//assert( (int)ask.size() == k + 1 );
int x = o_r( ask );
int y = xo_r( ask );
int z = no_t( y );
g.push_back( an_d( {x , z} ) );
g.push_back( an_d( { ll[i].fi , ll[i].se } ) );
}
for( int i = -(n + m); i <= n + m; i++ ){
if( r[i].empty() )continue;
bool f = true;
vector < int > ask;
for( int j = i; j <= i + k; j++ ){
if( r[j].empty() ){
continue;
}
assert( rr.find(j) != rr.end() );
ask.push_back( rr[j].fi );
}
if( (int)ask.size() < 1 )continue;
//assert( (int)ask.size() == k + 1 );
int x = o_r( ask );
int y = xo_r( ask );
int z = no_t( y );
ff.push_back( an_d( {x , z} ) );
ff.push_back( an_d( {rr[i].fi , rr[i].se} ) );
}
return an_d( { o_r( g ), o_r( ff ) } );
}
void construct_network(int H, int W, int K)
{
n = H;
m = W;
qur = n * m - 1;
for( int i = 0; i < n; i++ ){
for( int j = 0; j < m; j++ ){
int x = i - j , y = i + j;
l[x].push_back(i * m + j);
r[y].push_back(i * m + j);
}
}
for( int i = -(n + m); i <= n + m; i++ ){
if( l[i].empty() )continue;
int x = o_r(l[i]);
int y = xo_r(l[i]);
ll[i] = { x , no_t(y) };
}
for( int i = -(n + m); i <= n + m; i++ ){
if( r[i].empty() )continue;
int x = o_r( r[i] );
int y = xo_r(r[i]);
rr[i] = { x , no_t(y) };
}
int x = foo( K );
int y = foo( K - 1 );
y = no_t( y );
vector < int > f;
f.push_back(x);
f.push_back(y);
an_d(f);
// o_r( f );
}
Compilation message
vision.cpp: In function 'int foo(int)':
vision.cpp:50:14: warning: unused variable 'f' [-Wunused-variable]
50 | bool f = true;
| ^
vision.cpp:69:14: warning: unused variable 'f' [-Wunused-variable]
69 | bool f = true;
| ^
# |
결과 |
실행 시간 |
메모리 |
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 |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 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 |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 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 |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 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 |
384 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 |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 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 |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 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 |
384 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 |
384 KB |
Output is correct |
28 |
Correct |
3 ms |
544 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
512 KB |
Output is correct |
31 |
Correct |
3 ms |
512 KB |
Output is correct |
32 |
Correct |
2 ms |
512 KB |
Output is correct |
33 |
Correct |
3 ms |
532 KB |
Output is correct |
34 |
Correct |
3 ms |
512 KB |
Output is correct |
35 |
Correct |
4 ms |
640 KB |
Output is correct |
36 |
Correct |
4 ms |
768 KB |
Output is correct |
37 |
Correct |
4 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 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 |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 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 |
384 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 |
384 KB |
Output is correct |
28 |
Correct |
3 ms |
544 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
512 KB |
Output is correct |
31 |
Correct |
3 ms |
512 KB |
Output is correct |
32 |
Correct |
2 ms |
512 KB |
Output is correct |
33 |
Correct |
3 ms |
532 KB |
Output is correct |
34 |
Correct |
3 ms |
512 KB |
Output is correct |
35 |
Correct |
4 ms |
640 KB |
Output is correct |
36 |
Correct |
4 ms |
768 KB |
Output is correct |
37 |
Correct |
4 ms |
640 KB |
Output is correct |
38 |
Correct |
20 ms |
1908 KB |
Output is correct |
39 |
Correct |
5 ms |
768 KB |
Output is correct |
40 |
Correct |
9 ms |
896 KB |
Output is correct |
41 |
Correct |
6 ms |
896 KB |
Output is correct |
42 |
Correct |
21 ms |
1664 KB |
Output is correct |
43 |
Correct |
10 ms |
1276 KB |
Output is correct |
44 |
Correct |
20 ms |
1916 KB |
Output is correct |
45 |
Correct |
28 ms |
2428 KB |
Output is correct |
46 |
Correct |
33 ms |
2804 KB |
Output is correct |
47 |
Correct |
37 ms |
2804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
768 KB |
Output is correct |
2 |
Correct |
22 ms |
1788 KB |
Output is correct |
3 |
Correct |
22 ms |
1788 KB |
Output is correct |
4 |
Correct |
31 ms |
2164 KB |
Output is correct |
5 |
Correct |
5 ms |
892 KB |
Output is correct |
6 |
Correct |
17 ms |
1532 KB |
Output is correct |
7 |
Correct |
30 ms |
2036 KB |
Output is correct |
8 |
Correct |
30 ms |
2172 KB |
Output is correct |
9 |
Correct |
4 ms |
892 KB |
Output is correct |
10 |
Correct |
15 ms |
1404 KB |
Output is correct |
11 |
Correct |
22 ms |
1788 KB |
Output is correct |
12 |
Correct |
22 ms |
1788 KB |
Output is correct |
13 |
Correct |
27 ms |
2036 KB |
Output is correct |
14 |
Correct |
31 ms |
2172 KB |
Output is correct |
15 |
Correct |
4 ms |
892 KB |
Output is correct |
16 |
Correct |
15 ms |
1404 KB |
Output is correct |
17 |
Correct |
22 ms |
1788 KB |
Output is correct |
18 |
Correct |
22 ms |
1788 KB |
Output is correct |
19 |
Correct |
28 ms |
2036 KB |
Output is correct |
20 |
Correct |
30 ms |
2164 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
768 KB |
Output is correct |
4 |
Correct |
9 ms |
1024 KB |
Output is correct |
5 |
Correct |
12 ms |
1280 KB |
Output is correct |
6 |
Correct |
14 ms |
1280 KB |
Output is correct |
7 |
Correct |
15 ms |
1408 KB |
Output is correct |
8 |
Correct |
7 ms |
1152 KB |
Output is correct |
9 |
Correct |
16 ms |
1532 KB |
Output is correct |
10 |
Correct |
21 ms |
1916 KB |
Output is correct |
11 |
Correct |
26 ms |
2176 KB |
Output is correct |
12 |
Correct |
28 ms |
2172 KB |
Output is correct |
13 |
Correct |
6 ms |
768 KB |
Output is correct |
14 |
Correct |
18 ms |
1532 KB |
Output is correct |
15 |
Correct |
26 ms |
2036 KB |
Output is correct |
16 |
Correct |
31 ms |
2164 KB |
Output is correct |
17 |
Correct |
5 ms |
892 KB |
Output is correct |
18 |
Correct |
23 ms |
1788 KB |
Output is correct |
19 |
Correct |
30 ms |
2164 KB |
Output is correct |
20 |
Correct |
18 ms |
2044 KB |
Output is correct |
21 |
Correct |
48 ms |
3956 KB |
Output is correct |
22 |
Correct |
87 ms |
5104 KB |
Output is correct |
23 |
Correct |
78 ms |
5620 KB |
Output is correct |
24 |
Correct |
18 ms |
2044 KB |
Output is correct |
25 |
Correct |
59 ms |
4636 KB |
Output is correct |
26 |
Correct |
79 ms |
5624 KB |
Output is correct |
27 |
Incorrect |
10 ms |
2300 KB |
WA in grader: Too many instructions |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
2300 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 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 |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 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 |
384 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 |
384 KB |
Output is correct |
28 |
Correct |
3 ms |
544 KB |
Output is correct |
29 |
Correct |
2 ms |
384 KB |
Output is correct |
30 |
Correct |
2 ms |
512 KB |
Output is correct |
31 |
Correct |
3 ms |
512 KB |
Output is correct |
32 |
Correct |
2 ms |
512 KB |
Output is correct |
33 |
Correct |
3 ms |
532 KB |
Output is correct |
34 |
Correct |
3 ms |
512 KB |
Output is correct |
35 |
Correct |
4 ms |
640 KB |
Output is correct |
36 |
Correct |
4 ms |
768 KB |
Output is correct |
37 |
Correct |
4 ms |
640 KB |
Output is correct |
38 |
Correct |
20 ms |
1908 KB |
Output is correct |
39 |
Correct |
5 ms |
768 KB |
Output is correct |
40 |
Correct |
9 ms |
896 KB |
Output is correct |
41 |
Correct |
6 ms |
896 KB |
Output is correct |
42 |
Correct |
21 ms |
1664 KB |
Output is correct |
43 |
Correct |
10 ms |
1276 KB |
Output is correct |
44 |
Correct |
20 ms |
1916 KB |
Output is correct |
45 |
Correct |
28 ms |
2428 KB |
Output is correct |
46 |
Correct |
33 ms |
2804 KB |
Output is correct |
47 |
Correct |
37 ms |
2804 KB |
Output is correct |
48 |
Correct |
6 ms |
768 KB |
Output is correct |
49 |
Correct |
22 ms |
1788 KB |
Output is correct |
50 |
Correct |
22 ms |
1788 KB |
Output is correct |
51 |
Correct |
31 ms |
2164 KB |
Output is correct |
52 |
Correct |
5 ms |
892 KB |
Output is correct |
53 |
Correct |
17 ms |
1532 KB |
Output is correct |
54 |
Correct |
30 ms |
2036 KB |
Output is correct |
55 |
Correct |
30 ms |
2172 KB |
Output is correct |
56 |
Correct |
4 ms |
892 KB |
Output is correct |
57 |
Correct |
15 ms |
1404 KB |
Output is correct |
58 |
Correct |
22 ms |
1788 KB |
Output is correct |
59 |
Correct |
22 ms |
1788 KB |
Output is correct |
60 |
Correct |
27 ms |
2036 KB |
Output is correct |
61 |
Correct |
31 ms |
2172 KB |
Output is correct |
62 |
Correct |
4 ms |
892 KB |
Output is correct |
63 |
Correct |
15 ms |
1404 KB |
Output is correct |
64 |
Correct |
22 ms |
1788 KB |
Output is correct |
65 |
Correct |
22 ms |
1788 KB |
Output is correct |
66 |
Correct |
28 ms |
2036 KB |
Output is correct |
67 |
Correct |
30 ms |
2164 KB |
Output is correct |
68 |
Correct |
1 ms |
256 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 |
384 KB |
Output is correct |
72 |
Correct |
5 ms |
768 KB |
Output is correct |
73 |
Correct |
9 ms |
1024 KB |
Output is correct |
74 |
Correct |
12 ms |
1280 KB |
Output is correct |
75 |
Correct |
14 ms |
1280 KB |
Output is correct |
76 |
Correct |
15 ms |
1408 KB |
Output is correct |
77 |
Correct |
7 ms |
1152 KB |
Output is correct |
78 |
Correct |
16 ms |
1532 KB |
Output is correct |
79 |
Correct |
21 ms |
1916 KB |
Output is correct |
80 |
Correct |
26 ms |
2176 KB |
Output is correct |
81 |
Correct |
28 ms |
2172 KB |
Output is correct |
82 |
Correct |
6 ms |
768 KB |
Output is correct |
83 |
Correct |
18 ms |
1532 KB |
Output is correct |
84 |
Correct |
26 ms |
2036 KB |
Output is correct |
85 |
Correct |
31 ms |
2164 KB |
Output is correct |
86 |
Correct |
5 ms |
892 KB |
Output is correct |
87 |
Correct |
23 ms |
1788 KB |
Output is correct |
88 |
Correct |
30 ms |
2164 KB |
Output is correct |
89 |
Correct |
18 ms |
2044 KB |
Output is correct |
90 |
Correct |
48 ms |
3956 KB |
Output is correct |
91 |
Correct |
87 ms |
5104 KB |
Output is correct |
92 |
Correct |
78 ms |
5620 KB |
Output is correct |
93 |
Correct |
18 ms |
2044 KB |
Output is correct |
94 |
Correct |
59 ms |
4636 KB |
Output is correct |
95 |
Correct |
79 ms |
5624 KB |
Output is correct |
96 |
Incorrect |
10 ms |
2300 KB |
WA in grader: Too many instructions |
97 |
Halted |
0 ms |
0 KB |
- |