#include "vision.h"
#include<algorithm>
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int dist(int x, int y, int i, int j) {
return abs(x - i) + abs(y - j);
}
void construct_network(int H, int W, int K) {
vector<int>res;
vector<int>xrow(H), xcol(W);
for (int i = 0 ; i < H ; ++ i) {
vector<int>cur;
for (int j = 0 ; j < W ; ++ j) {
cur.emplace_back(i * W + j);
}
xrow[i] = add_xor(cur);
}
for (int j = 0 ; j < W ; ++ j) {
vector<int>cur;
for (int i = 0 ; i < H ; ++ i) {
cur.emplace_back(i * W + j);
}
xcol[j] = add_xor(cur);
}
vector<int>temp;
for (int i = 0 ; i < H ; ++ i) temp.emplace_back(xrow[i]);
int zrow = add_or(temp);
zrow = add_not(zrow);
temp.clear();
for (int i = 0 ; i < W ; ++ i) temp.emplace_back(xcol[i]);
int zcol = add_or(temp);
zcol = add_not(zcol);
for (int i = 1 ; i < H ; ++ i) {
int a = xrow[i - 1];
int b = xrow[i];
int c = zcol;
res.emplace_back(add_and({a, b, c}));
}
for (int i = 1 ; i < W ; ++ i) {
int a = xcol[i - 1];
int b = xcol[i];
int c = zrow;
res.emplace_back(add_and({a, b, c}));
}
add_or(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1108 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
5 ms |
724 KB |
Output is correct |
8 |
Correct |
6 ms |
724 KB |
Output is correct |
9 |
Correct |
8 ms |
1108 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |