#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
void construct_network(int H, int W, int K) {
vector<int> row;
vector<int> col;
for (int i = 0; i < H * W; i++) col.push_back(i % W), row.push_back(i / W);
vector<vector<int>> maindiag(H + W - 1);
for (int i = 0; i < H * W; i++) maindiag[col[i] + row[i]].push_back(i);
int sz = H * W;
for (int i = 0; i < H + W - 1; i++) {
add_or(maindiag[i]);
sz++;
}
int start = sz;
for (int i = 0; i < H + W - 1 - K; i++) {
vector<int> inp;
inp.push_back(H * W + i);
inp.push_back(H * W + i + K);
add_and(inp);
sz++;
}
vector<int> maink;
for (int i = start; i < start + H + W - 1 - K; i++) maink.push_back(i);
add_or(maink);
int KFIRST = sz;
sz++;
vector<int> morek;
for (int i = 0; i < H + W - 1 - K; i++) {
vector<int> inp1;
for (int j = i + K; j < H + W - 1; j++) inp1.push_back(H * W + j);
add_or(inp1);
sz++;
vector<int> inp2;
inp2.push_back(H * W + i);
inp2.push_back(sz - 1);
add_and(inp2);
morek.push_back(sz);
sz++;
}
add_or(morek);
add_not(sz);
sz++;
int LKFIRST = sz;
sz++;
vector<vector<int>> otherdiag(H + W - 1);
for (int i = 0; i < H * W; i++) otherdiag[W - 1 - col[i] + row[i]].push_back(i);
int start2 = sz;
for (int i = 0; i < H + W - 1; i++) {
add_or(otherdiag[i]);
sz++;
}
start = sz;
for (int i = 0; i < H + W - 1 - K; i++) {
vector<int> inp;
inp.push_back(start2 + i);
inp.push_back(start2 + i + K);
add_and(inp);
sz++;
}
vector<int> otherk;
for (int i = start; i < start + H + W - 1 - K; i++) otherk.push_back(i);
add_or(otherk);
int KSECOND = sz;
sz++;
vector<int> moreok;
for (int i = 0; i < H + W - 1 - K; i++) {
vector<int> inp1;
for (int j = i + K; j < H + W - 1; j++) inp1.push_back(start2 + j);
add_or(inp1);
sz++;
vector<int> inp2;
inp2.push_back(start2 + i);
inp2.push_back(sz - 1);
add_and(inp2);
moreok.push_back(sz);
sz++;
}
add_or(moreok);
add_not(sz);
sz++;
int LKSECOND = sz;
sz++;
add_and({KFIRST, LKSECOND});
add_and({LKFIRST, KSECOND});
add_or({sz, sz + 1});
sz += 3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
860 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
3464 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |