#include "vision.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
vector<int> g[200*200+5];
vector<pii> dir{{-1, -1}, {-1, 1}, {1, -1}, {1, 1}};
int vis[200*200+5];
int col[200*200+5];
void dfs(int v){
vis[v] = 1;
if(col[v] == 0)
for(auto u : g[v])
col[u] = 1;
for(auto u : g[v])
if(vis[u] == 0)
dfs(u);
}
void construct_network(int H, int W, int K){
srand(time(NULL));
vector<int> finalcomp;
for(int i = 0; i < H; ++i)
for(int j = 0; j < W; ++j){
for(int k = 0; k <= K; ++k)
for(auto u : dir){
int i1 = i + u.ff*k;
int j1 = j + u.ss*(K-k);
if(i1 >= 0 && i1 < H && j1 >= 0 && j1 < W)
g[i*W+j].pb(i1*W+j1);
}
}
for(int i = 0; i < H*W; ++i){
if(vis[i] == 0){
col[i] = rand()%2;
dfs(i);
}
if(col[i] && g[i].size())
finalcomp.pb(add_and({i, add_or(g[i])}));
}
add_or(finalcomp);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
1 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
1 ms |
1280 KB |
Output is correct |
6 |
Correct |
1 ms |
1280 KB |
Output is correct |
7 |
Correct |
1 ms |
1280 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1280 KB |
Output is correct |
10 |
Correct |
1 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Correct |
1 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
1 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1280 KB |
Output is correct |
16 |
Correct |
1 ms |
1280 KB |
Output is correct |
17 |
Correct |
1 ms |
1280 KB |
Output is correct |
18 |
Correct |
1 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
1 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
1 ms |
1280 KB |
Output is correct |
6 |
Correct |
1 ms |
1280 KB |
Output is correct |
7 |
Correct |
1 ms |
1280 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1280 KB |
Output is correct |
10 |
Correct |
1 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Correct |
1 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
1 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1280 KB |
Output is correct |
16 |
Correct |
1 ms |
1280 KB |
Output is correct |
17 |
Correct |
1 ms |
1280 KB |
Output is correct |
18 |
Correct |
1 ms |
1280 KB |
Output is correct |
19 |
Correct |
1 ms |
1280 KB |
Output is correct |
20 |
Correct |
1 ms |
1280 KB |
Output is correct |
21 |
Correct |
1 ms |
1280 KB |
Output is correct |
22 |
Correct |
1 ms |
1280 KB |
Output is correct |
23 |
Correct |
1 ms |
1280 KB |
Output is correct |
24 |
Correct |
2 ms |
1280 KB |
Output is correct |
25 |
Correct |
2 ms |
1280 KB |
Output is correct |
26 |
Correct |
2 ms |
1280 KB |
Output is correct |
27 |
Correct |
1 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
1 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
1 ms |
1280 KB |
Output is correct |
6 |
Correct |
1 ms |
1280 KB |
Output is correct |
7 |
Correct |
1 ms |
1280 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1280 KB |
Output is correct |
10 |
Correct |
1 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Correct |
1 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
1 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1280 KB |
Output is correct |
16 |
Correct |
1 ms |
1280 KB |
Output is correct |
17 |
Correct |
1 ms |
1280 KB |
Output is correct |
18 |
Correct |
1 ms |
1280 KB |
Output is correct |
19 |
Correct |
1 ms |
1280 KB |
Output is correct |
20 |
Correct |
1 ms |
1280 KB |
Output is correct |
21 |
Correct |
1 ms |
1280 KB |
Output is correct |
22 |
Correct |
1 ms |
1280 KB |
Output is correct |
23 |
Correct |
1 ms |
1280 KB |
Output is correct |
24 |
Correct |
2 ms |
1280 KB |
Output is correct |
25 |
Correct |
2 ms |
1280 KB |
Output is correct |
26 |
Correct |
2 ms |
1280 KB |
Output is correct |
27 |
Correct |
1 ms |
1280 KB |
Output is correct |
28 |
Correct |
4 ms |
1664 KB |
Output is correct |
29 |
Correct |
1 ms |
1280 KB |
Output is correct |
30 |
Correct |
1 ms |
1280 KB |
Output is correct |
31 |
Correct |
1 ms |
1280 KB |
Output is correct |
32 |
Correct |
2 ms |
1408 KB |
Output is correct |
33 |
Correct |
2 ms |
1408 KB |
Output is correct |
34 |
Correct |
4 ms |
1664 KB |
Output is correct |
35 |
Correct |
4 ms |
1536 KB |
Output is correct |
36 |
Correct |
2 ms |
1408 KB |
Output is correct |
37 |
Correct |
2 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
1 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
1 ms |
1280 KB |
Output is correct |
6 |
Correct |
1 ms |
1280 KB |
Output is correct |
7 |
Correct |
1 ms |
1280 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1280 KB |
Output is correct |
10 |
Correct |
1 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Correct |
1 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
1 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1280 KB |
Output is correct |
16 |
Correct |
1 ms |
1280 KB |
Output is correct |
17 |
Correct |
1 ms |
1280 KB |
Output is correct |
18 |
Correct |
1 ms |
1280 KB |
Output is correct |
19 |
Correct |
1 ms |
1280 KB |
Output is correct |
20 |
Correct |
1 ms |
1280 KB |
Output is correct |
21 |
Correct |
1 ms |
1280 KB |
Output is correct |
22 |
Correct |
1 ms |
1280 KB |
Output is correct |
23 |
Correct |
1 ms |
1280 KB |
Output is correct |
24 |
Correct |
2 ms |
1280 KB |
Output is correct |
25 |
Correct |
2 ms |
1280 KB |
Output is correct |
26 |
Correct |
2 ms |
1280 KB |
Output is correct |
27 |
Correct |
1 ms |
1280 KB |
Output is correct |
28 |
Correct |
4 ms |
1664 KB |
Output is correct |
29 |
Correct |
1 ms |
1280 KB |
Output is correct |
30 |
Correct |
1 ms |
1280 KB |
Output is correct |
31 |
Correct |
1 ms |
1280 KB |
Output is correct |
32 |
Correct |
2 ms |
1408 KB |
Output is correct |
33 |
Correct |
2 ms |
1408 KB |
Output is correct |
34 |
Correct |
4 ms |
1664 KB |
Output is correct |
35 |
Correct |
4 ms |
1536 KB |
Output is correct |
36 |
Correct |
2 ms |
1408 KB |
Output is correct |
37 |
Correct |
2 ms |
1280 KB |
Output is correct |
38 |
Incorrect |
29 ms |
10992 KB |
WA in grader: Too many instructions |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
1 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
1 ms |
1280 KB |
Output is correct |
6 |
Correct |
2 ms |
1280 KB |
Output is correct |
7 |
Correct |
1 ms |
1280 KB |
Output is correct |
8 |
Correct |
2 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1280 KB |
Output is correct |
10 |
Correct |
1 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Correct |
2 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
2 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1280 KB |
Output is correct |
16 |
Correct |
1 ms |
1280 KB |
Output is correct |
17 |
Correct |
2 ms |
1280 KB |
Output is correct |
18 |
Correct |
2 ms |
1280 KB |
Output is correct |
19 |
Correct |
1 ms |
1280 KB |
Output is correct |
20 |
Correct |
2 ms |
1280 KB |
Output is correct |
21 |
Correct |
1 ms |
1280 KB |
Output is correct |
22 |
Correct |
1 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
5 ms |
1792 KB |
Output is correct |
4 |
Correct |
14 ms |
2944 KB |
Output is correct |
5 |
Correct |
12 ms |
2432 KB |
Output is correct |
6 |
Correct |
6 ms |
1664 KB |
Output is correct |
7 |
Correct |
4 ms |
1280 KB |
Output is correct |
8 |
Correct |
9 ms |
2428 KB |
Output is correct |
9 |
Correct |
37 ms |
6260 KB |
Output is correct |
10 |
Correct |
26 ms |
4340 KB |
Output is correct |
11 |
Correct |
13 ms |
2304 KB |
Output is correct |
12 |
Correct |
9 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
1 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1312 KB |
Output is correct |
16 |
Correct |
2 ms |
1280 KB |
Output is correct |
17 |
Correct |
1 ms |
1280 KB |
Output is correct |
18 |
Correct |
1 ms |
1280 KB |
Output is correct |
19 |
Correct |
1 ms |
1280 KB |
Output is correct |
20 |
Incorrect |
8 ms |
3836 KB |
WA in grader: Too many instructions |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
5628 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1280 KB |
Output is correct |
2 |
Correct |
1 ms |
1280 KB |
Output is correct |
3 |
Correct |
1 ms |
1280 KB |
Output is correct |
4 |
Correct |
1 ms |
1280 KB |
Output is correct |
5 |
Correct |
1 ms |
1280 KB |
Output is correct |
6 |
Correct |
1 ms |
1280 KB |
Output is correct |
7 |
Correct |
1 ms |
1280 KB |
Output is correct |
8 |
Correct |
1 ms |
1280 KB |
Output is correct |
9 |
Correct |
1 ms |
1280 KB |
Output is correct |
10 |
Correct |
1 ms |
1280 KB |
Output is correct |
11 |
Correct |
1 ms |
1280 KB |
Output is correct |
12 |
Correct |
1 ms |
1280 KB |
Output is correct |
13 |
Correct |
1 ms |
1280 KB |
Output is correct |
14 |
Correct |
1 ms |
1280 KB |
Output is correct |
15 |
Correct |
1 ms |
1280 KB |
Output is correct |
16 |
Correct |
1 ms |
1280 KB |
Output is correct |
17 |
Correct |
1 ms |
1280 KB |
Output is correct |
18 |
Correct |
1 ms |
1280 KB |
Output is correct |
19 |
Correct |
1 ms |
1280 KB |
Output is correct |
20 |
Correct |
1 ms |
1280 KB |
Output is correct |
21 |
Correct |
1 ms |
1280 KB |
Output is correct |
22 |
Correct |
1 ms |
1280 KB |
Output is correct |
23 |
Correct |
1 ms |
1280 KB |
Output is correct |
24 |
Correct |
2 ms |
1280 KB |
Output is correct |
25 |
Correct |
2 ms |
1280 KB |
Output is correct |
26 |
Correct |
2 ms |
1280 KB |
Output is correct |
27 |
Correct |
1 ms |
1280 KB |
Output is correct |
28 |
Correct |
4 ms |
1664 KB |
Output is correct |
29 |
Correct |
1 ms |
1280 KB |
Output is correct |
30 |
Correct |
1 ms |
1280 KB |
Output is correct |
31 |
Correct |
1 ms |
1280 KB |
Output is correct |
32 |
Correct |
2 ms |
1408 KB |
Output is correct |
33 |
Correct |
2 ms |
1408 KB |
Output is correct |
34 |
Correct |
4 ms |
1664 KB |
Output is correct |
35 |
Correct |
4 ms |
1536 KB |
Output is correct |
36 |
Correct |
2 ms |
1408 KB |
Output is correct |
37 |
Correct |
2 ms |
1280 KB |
Output is correct |
38 |
Incorrect |
29 ms |
10992 KB |
WA in grader: Too many instructions |
39 |
Halted |
0 ms |
0 KB |
- |