#include <bits/stdc++.h>
#include "vision.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
const int MOD = 1e9 + 7;
int calc(int x, int y, int W) {
return x * W + y;
}
int dist(int x, int y, int X, int Y) {
return abs(x - X) + abs(y - Y);
}
map<int, int> V[40000];
void construct_network(int H, int W, int K) {
vector<int> res;
for(int l = 0; l < H; l++) {
for(int i = 0; i < W; i++) {
vector<int> S;
for(int j = -K; j <= K; j++) {
int k = K - abs(j);
if(l + k >= 0 && l + k < H && i + j >= 0 && i + j < W) {
if(V[calc(l, i, W)][calc(l + k, i + j, W)]) continue;
V[calc(l, i, W)][calc(l + k, i + j, W)] = V[calc(l + k, i + j, W)][calc(l, i, W)] = 1;
S.push_back(calc(l + k, i + j, W));
}
}
if(S.empty()) continue;
res.push_back(add_and({calc(l, i, W), add_or(S)}));
}
}
add_or(res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
1 ms |
2132 KB |
Output is correct |
4 |
Correct |
1 ms |
2132 KB |
Output is correct |
5 |
Correct |
1 ms |
2132 KB |
Output is correct |
6 |
Correct |
1 ms |
2132 KB |
Output is correct |
7 |
Correct |
1 ms |
2132 KB |
Output is correct |
8 |
Correct |
1 ms |
2132 KB |
Output is correct |
9 |
Correct |
1 ms |
2132 KB |
Output is correct |
10 |
Correct |
1 ms |
2132 KB |
Output is correct |
11 |
Correct |
1 ms |
2132 KB |
Output is correct |
12 |
Correct |
1 ms |
2132 KB |
Output is correct |
13 |
Correct |
2 ms |
2132 KB |
Output is correct |
14 |
Correct |
1 ms |
2132 KB |
Output is correct |
15 |
Correct |
1 ms |
2132 KB |
Output is correct |
16 |
Correct |
1 ms |
2132 KB |
Output is correct |
17 |
Correct |
1 ms |
2132 KB |
Output is correct |
18 |
Correct |
1 ms |
2132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
1 ms |
2132 KB |
Output is correct |
4 |
Correct |
1 ms |
2132 KB |
Output is correct |
5 |
Correct |
1 ms |
2132 KB |
Output is correct |
6 |
Correct |
1 ms |
2132 KB |
Output is correct |
7 |
Correct |
1 ms |
2132 KB |
Output is correct |
8 |
Correct |
1 ms |
2132 KB |
Output is correct |
9 |
Correct |
1 ms |
2132 KB |
Output is correct |
10 |
Correct |
1 ms |
2132 KB |
Output is correct |
11 |
Correct |
1 ms |
2132 KB |
Output is correct |
12 |
Correct |
1 ms |
2132 KB |
Output is correct |
13 |
Correct |
2 ms |
2132 KB |
Output is correct |
14 |
Correct |
1 ms |
2132 KB |
Output is correct |
15 |
Correct |
1 ms |
2132 KB |
Output is correct |
16 |
Correct |
1 ms |
2132 KB |
Output is correct |
17 |
Correct |
1 ms |
2132 KB |
Output is correct |
18 |
Correct |
1 ms |
2132 KB |
Output is correct |
19 |
Correct |
1 ms |
2132 KB |
Output is correct |
20 |
Correct |
1 ms |
2132 KB |
Output is correct |
21 |
Correct |
1 ms |
2132 KB |
Output is correct |
22 |
Correct |
1 ms |
2104 KB |
Output is correct |
23 |
Correct |
1 ms |
2144 KB |
Output is correct |
24 |
Correct |
2 ms |
2132 KB |
Output is correct |
25 |
Correct |
2 ms |
2132 KB |
Output is correct |
26 |
Correct |
2 ms |
2132 KB |
Output is correct |
27 |
Correct |
1 ms |
2132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
1 ms |
2132 KB |
Output is correct |
4 |
Correct |
1 ms |
2132 KB |
Output is correct |
5 |
Correct |
1 ms |
2132 KB |
Output is correct |
6 |
Correct |
1 ms |
2132 KB |
Output is correct |
7 |
Correct |
1 ms |
2132 KB |
Output is correct |
8 |
Correct |
1 ms |
2132 KB |
Output is correct |
9 |
Correct |
1 ms |
2132 KB |
Output is correct |
10 |
Correct |
1 ms |
2132 KB |
Output is correct |
11 |
Correct |
1 ms |
2132 KB |
Output is correct |
12 |
Correct |
1 ms |
2132 KB |
Output is correct |
13 |
Correct |
2 ms |
2132 KB |
Output is correct |
14 |
Correct |
1 ms |
2132 KB |
Output is correct |
15 |
Correct |
1 ms |
2132 KB |
Output is correct |
16 |
Correct |
1 ms |
2132 KB |
Output is correct |
17 |
Correct |
1 ms |
2132 KB |
Output is correct |
18 |
Correct |
1 ms |
2132 KB |
Output is correct |
19 |
Correct |
1 ms |
2132 KB |
Output is correct |
20 |
Correct |
1 ms |
2132 KB |
Output is correct |
21 |
Correct |
1 ms |
2132 KB |
Output is correct |
22 |
Correct |
1 ms |
2104 KB |
Output is correct |
23 |
Correct |
1 ms |
2144 KB |
Output is correct |
24 |
Correct |
2 ms |
2132 KB |
Output is correct |
25 |
Correct |
2 ms |
2132 KB |
Output is correct |
26 |
Correct |
2 ms |
2132 KB |
Output is correct |
27 |
Correct |
1 ms |
2132 KB |
Output is correct |
28 |
Correct |
7 ms |
3796 KB |
Output is correct |
29 |
Correct |
1 ms |
2132 KB |
Output is correct |
30 |
Correct |
1 ms |
2132 KB |
Output is correct |
31 |
Correct |
1 ms |
2132 KB |
Output is correct |
32 |
Correct |
2 ms |
2388 KB |
Output is correct |
33 |
Correct |
2 ms |
2388 KB |
Output is correct |
34 |
Correct |
7 ms |
3796 KB |
Output is correct |
35 |
Correct |
5 ms |
3284 KB |
Output is correct |
36 |
Correct |
2 ms |
2260 KB |
Output is correct |
37 |
Correct |
1 ms |
2132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
1 ms |
2132 KB |
Output is correct |
4 |
Correct |
1 ms |
2132 KB |
Output is correct |
5 |
Correct |
1 ms |
2132 KB |
Output is correct |
6 |
Correct |
1 ms |
2132 KB |
Output is correct |
7 |
Correct |
1 ms |
2132 KB |
Output is correct |
8 |
Correct |
1 ms |
2132 KB |
Output is correct |
9 |
Correct |
1 ms |
2132 KB |
Output is correct |
10 |
Correct |
1 ms |
2132 KB |
Output is correct |
11 |
Correct |
1 ms |
2132 KB |
Output is correct |
12 |
Correct |
1 ms |
2132 KB |
Output is correct |
13 |
Correct |
2 ms |
2132 KB |
Output is correct |
14 |
Correct |
1 ms |
2132 KB |
Output is correct |
15 |
Correct |
1 ms |
2132 KB |
Output is correct |
16 |
Correct |
1 ms |
2132 KB |
Output is correct |
17 |
Correct |
1 ms |
2132 KB |
Output is correct |
18 |
Correct |
1 ms |
2132 KB |
Output is correct |
19 |
Correct |
1 ms |
2132 KB |
Output is correct |
20 |
Correct |
1 ms |
2132 KB |
Output is correct |
21 |
Correct |
1 ms |
2132 KB |
Output is correct |
22 |
Correct |
1 ms |
2104 KB |
Output is correct |
23 |
Correct |
1 ms |
2144 KB |
Output is correct |
24 |
Correct |
2 ms |
2132 KB |
Output is correct |
25 |
Correct |
2 ms |
2132 KB |
Output is correct |
26 |
Correct |
2 ms |
2132 KB |
Output is correct |
27 |
Correct |
1 ms |
2132 KB |
Output is correct |
28 |
Correct |
7 ms |
3796 KB |
Output is correct |
29 |
Correct |
1 ms |
2132 KB |
Output is correct |
30 |
Correct |
1 ms |
2132 KB |
Output is correct |
31 |
Correct |
1 ms |
2132 KB |
Output is correct |
32 |
Correct |
2 ms |
2388 KB |
Output is correct |
33 |
Correct |
2 ms |
2388 KB |
Output is correct |
34 |
Correct |
7 ms |
3796 KB |
Output is correct |
35 |
Correct |
5 ms |
3284 KB |
Output is correct |
36 |
Correct |
2 ms |
2260 KB |
Output is correct |
37 |
Correct |
1 ms |
2132 KB |
Output is correct |
38 |
Incorrect |
195 ms |
39336 KB |
WA in grader: Too many instructions |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
1 ms |
2156 KB |
Output is correct |
4 |
Correct |
1 ms |
2132 KB |
Output is correct |
5 |
Correct |
1 ms |
2132 KB |
Output is correct |
6 |
Correct |
1 ms |
2132 KB |
Output is correct |
7 |
Correct |
1 ms |
2132 KB |
Output is correct |
8 |
Correct |
1 ms |
2132 KB |
Output is correct |
9 |
Correct |
2 ms |
2132 KB |
Output is correct |
10 |
Correct |
1 ms |
2132 KB |
Output is correct |
11 |
Correct |
2 ms |
2132 KB |
Output is correct |
12 |
Correct |
1 ms |
2132 KB |
Output is correct |
13 |
Correct |
1 ms |
2132 KB |
Output is correct |
14 |
Correct |
1 ms |
2132 KB |
Output is correct |
15 |
Correct |
1 ms |
2132 KB |
Output is correct |
16 |
Correct |
2 ms |
2132 KB |
Output is correct |
17 |
Correct |
1 ms |
2132 KB |
Output is correct |
18 |
Correct |
2 ms |
2132 KB |
Output is correct |
19 |
Correct |
2 ms |
2132 KB |
Output is correct |
20 |
Correct |
1 ms |
2132 KB |
Output is correct |
21 |
Correct |
1 ms |
2132 KB |
Output is correct |
22 |
Correct |
1 ms |
2132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
5 ms |
3152 KB |
Output is correct |
4 |
Correct |
30 ms |
9424 KB |
Output is correct |
5 |
Correct |
18 ms |
6356 KB |
Output is correct |
6 |
Correct |
7 ms |
3624 KB |
Output is correct |
7 |
Correct |
2 ms |
2132 KB |
Output is correct |
8 |
Incorrect |
4 ms |
3664 KB |
WA in grader: Too many instructions |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
3788 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2132 KB |
Output is correct |
2 |
Correct |
1 ms |
2132 KB |
Output is correct |
3 |
Correct |
1 ms |
2132 KB |
Output is correct |
4 |
Correct |
1 ms |
2132 KB |
Output is correct |
5 |
Correct |
1 ms |
2132 KB |
Output is correct |
6 |
Correct |
1 ms |
2132 KB |
Output is correct |
7 |
Correct |
1 ms |
2132 KB |
Output is correct |
8 |
Correct |
1 ms |
2132 KB |
Output is correct |
9 |
Correct |
1 ms |
2132 KB |
Output is correct |
10 |
Correct |
1 ms |
2132 KB |
Output is correct |
11 |
Correct |
1 ms |
2132 KB |
Output is correct |
12 |
Correct |
1 ms |
2132 KB |
Output is correct |
13 |
Correct |
2 ms |
2132 KB |
Output is correct |
14 |
Correct |
1 ms |
2132 KB |
Output is correct |
15 |
Correct |
1 ms |
2132 KB |
Output is correct |
16 |
Correct |
1 ms |
2132 KB |
Output is correct |
17 |
Correct |
1 ms |
2132 KB |
Output is correct |
18 |
Correct |
1 ms |
2132 KB |
Output is correct |
19 |
Correct |
1 ms |
2132 KB |
Output is correct |
20 |
Correct |
1 ms |
2132 KB |
Output is correct |
21 |
Correct |
1 ms |
2132 KB |
Output is correct |
22 |
Correct |
1 ms |
2104 KB |
Output is correct |
23 |
Correct |
1 ms |
2144 KB |
Output is correct |
24 |
Correct |
2 ms |
2132 KB |
Output is correct |
25 |
Correct |
2 ms |
2132 KB |
Output is correct |
26 |
Correct |
2 ms |
2132 KB |
Output is correct |
27 |
Correct |
1 ms |
2132 KB |
Output is correct |
28 |
Correct |
7 ms |
3796 KB |
Output is correct |
29 |
Correct |
1 ms |
2132 KB |
Output is correct |
30 |
Correct |
1 ms |
2132 KB |
Output is correct |
31 |
Correct |
1 ms |
2132 KB |
Output is correct |
32 |
Correct |
2 ms |
2388 KB |
Output is correct |
33 |
Correct |
2 ms |
2388 KB |
Output is correct |
34 |
Correct |
7 ms |
3796 KB |
Output is correct |
35 |
Correct |
5 ms |
3284 KB |
Output is correct |
36 |
Correct |
2 ms |
2260 KB |
Output is correct |
37 |
Correct |
1 ms |
2132 KB |
Output is correct |
38 |
Incorrect |
195 ms |
39336 KB |
WA in grader: Too many instructions |
39 |
Halted |
0 ms |
0 KB |
- |