#include "vision.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
void construct_network(int n, int m, int K){
vector<int> res(n);
auto idx = [&](int i, int j) -> int {
return i * m + j;
};
auto make = [&](int i, int l, int r) -> vector<int> {
vector<int> ret;
for (int j = l; j < r; j++)
ret.push_back(idx(i, j));
return ret;
};
for (int i = 0; i < n; i++)
res[i] = add_or(make(i, 0, m));
vector<int> row;
for (int i = 0; i < n; i++)
if (res[i] > 0)
row.push_back(i);
function<int(int, int, int)> search = [&](int i, int l, int r) -> int {
l--, r--;
while (l < r - 1){
int mid = (l + r + 1) / 2;
if (mid - l > 1 && add_or(make(i, l + 1, mid)) == 0)
l = mid;
else
r = mid;
}
return r;
};
vector<int> col(2);
auto check = [&](){
// for (int i = 0; i < 2; i++)
// assert(add_or({idx(row[i], col[i])}) == 1);
if (abs(row[0] - row[1]) + abs(col[0] - col[1]) == K)
add_or({idx(row[0], col[0])});
else
add_not(idx(row[0], col[0]));
};
if (row.size() == 2){
for (int i = 0; i < 2; i++)
col[i] = search(row[i], 0, m);
check();
}else{
row.push_back(row[0]);
col[0] = search(row[0], 0, m);
col[1] = search(row[0], col[0] + 1, m);
check();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
596 KB |
on inputs (126, 120), (176, 169), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |