#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K) {
vector<int> posleft(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (i + j == diag) {
v.push_back(i * W + j);
}
}
}
posleft[diag] = add_or(v);
}
vector<int> posright(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (j - i + H - 1 == diag) {
v.push_back(i * W + j);
}
}
}
posright[diag] = add_or(v);
}
vector<int> hastwoleft(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v;
for (int d = diag; d <= min(H + W - 2, diag + 2 * K + 1); d++) {
v.push_back(posleft[d]);
}
int orr = add_or(v);
int xorr = add_xor(v);
hastwoleft[diag] = add_and({orr, add_not(xorr)});
}
vector<int> hastworight(H + W);
for (int diag = 0; diag <= H + W - 2; diag++) {
vector<int> v;
for (int d = diag; d <= min(H + W - 2, diag + 2 * K + 1); d++) {
v.push_back(posright[d]);
}
int orr = add_or(v);
int xorr = add_xor(v);
hastworight[diag] = add_and({orr, add_not(xorr)});
}
vector<int> twodiagleft(H + W);
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
twodiagleft[diag] = add_and({posleft[diag], posleft[diag + K]});
}
vector<int> twodiagright(H + W);
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
twodiagright[diag] = add_and({posright[diag], posright[diag + K]});
}
int first;
{
vector<int> v;
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
v.push_back(twodiagleft[diag]);
}
int f1 = add_or(v);
v.clear();
for (int diag = 0; diag <= H + W - 2; diag++) {
v.push_back(hastworight[diag]);
}
int f2 = add_or(v);
first = add_and({f1, f2});
}
int second;
{
vector<int> v;
for (int diag = 0; diag <= H + W - 2 - K; diag++) {
v.push_back(twodiagright[diag]);
}
int f1 = add_or(v);
v.clear();
for (int diag = 0; diag <= H + W - 2; diag++) {
v.push_back(hastwoleft[diag]);
}
int f2 = add_or(v);
second = add_and({f1, f2});
}
add_or({first, second});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
14 ms |
1088 KB |
Output is correct |
3 |
Correct |
12 ms |
1108 KB |
Output is correct |
4 |
Correct |
10 ms |
1064 KB |
Output is correct |
5 |
Correct |
3 ms |
468 KB |
Output is correct |
6 |
Correct |
10 ms |
1156 KB |
Output is correct |
7 |
Correct |
10 ms |
1108 KB |
Output is correct |
8 |
Correct |
9 ms |
980 KB |
Output is correct |
9 |
Correct |
3 ms |
468 KB |
Output is correct |
10 |
Correct |
8 ms |
980 KB |
Output is correct |
11 |
Correct |
10 ms |
1180 KB |
Output is correct |
12 |
Correct |
10 ms |
1152 KB |
Output is correct |
13 |
Correct |
13 ms |
1100 KB |
Output is correct |
14 |
Correct |
14 ms |
1008 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
8 ms |
980 KB |
Output is correct |
17 |
Correct |
10 ms |
1108 KB |
Output is correct |
18 |
Correct |
13 ms |
1140 KB |
Output is correct |
19 |
Correct |
14 ms |
1108 KB |
Output is correct |
20 |
Correct |
10 ms |
1024 KB |
Output is correct |
21 |
Correct |
1 ms |
300 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
1396 KB |
on inputs (57, 107), (59, 108), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |