#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define n(i, j) ((i)*W + (j))
#define ALL(x) x.begin(), x.end()
void construct_network(int H, int W, int K) {
vector <int> r(H), c(W), N, R0, C0;
for (int i=0; i<H; i++) {
vector <int> list;
for (int j=0; j<W; j++) {
list.push_back(n(i, j));
}
R0.push_back(r[i] = add_xor(list));
}
for (int j=0; j<W; j++) {
vector <int> list;
for (int i=0; i<H; i++) {
list.push_back(n(i, j));
}
C0.push_back(c[j] = add_xor(list));
}
vector <int> distR(K+1), distC(K+1);
distR[0] = add_not(add_or(R0));
distC[0] = add_not(add_or(C0));
for (int i=1; i<=K; i++) {
vector <int> list;
for (int j=0; j<H-i; j++) {
list.push_back(add_and({r[j], r[j+i]}));
}
if (list.empty()) {
distC[i] = -1;
continue;
}
distR[i] = add_or(list);
}
for (int i=1; i<=K; i++) {
vector <int> list;
for (int j=0; j<W-i; j++) {
list.push_back(add_and({c[j], c[j+i]}));
}
if (list.empty()) {
distC[i] = -1;
continue;
}
distC[i] = add_or(list);
}
for (int i=0; i<=K; i++) {
if (distR[i] == -1 || distC[K-i] == -1) {
continue;
}
N.push_back(add_and({distR[i], distC[K-i]}));
}
add_or(N);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
2 ms |
1008 KB |
WA in grader: Too many instructions |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (1, 0), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 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 |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
4 ms |
724 KB |
Output is correct |
8 |
Correct |
4 ms |
724 KB |
Output is correct |
9 |
Correct |
7 ms |
1060 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |