#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[202][202], r[202], c[202];
int n, m;
void construct_network(int H, int W, int K) {
n = H, m = W;
for (int i = 0;i < n;i++) {
for (int j = 0;j < m;j++) {
a[i][j] = i * m + j;
}
}
if (n == 1) {
vector<int> ans;
for (int j = 0;j < m - 1;j++) ans.push_back(add_and({ a[0][j], a[0][j + 1] }));
add_or(ans);
return;
}
if (m == 1) {
vector<int> ans;
for (int i = 0;i < n - 1;i++) ans.push_back(add_and({ a[i + 1][0], a[i][0] }));
add_or(ans);
return;
}
for (int i = 0;i < n;i++) {
vector<int> Q;
for (int j = 0;j < m;j++) Q.push_back(a[i][j]);
r[i] = add_xor(Q);
}
for (int j = 0;j < m;j++) {
vector<int> Q;
for (int i = 0;i < n;i++) Q.push_back(a[i][j]);
c[j] = add_xor(Q);
}
int same_row = 0, same_col = 0;
{
vector<int> Q;
for (int i = 0;i < n;i++) Q.push_back(r[i]);
same_row = add_not(add_or(Q));
}
{
vector<int> Q;
for (int i = 0;i < m;i++) Q.push_back(c[i]);
same_col = add_not(add_or(Q));
}
int adj_row = 0, adj_col = 0;
{
vector<int> Q;
for (int i = 0;i < n - 1;i++) Q.push_back(add_and({ r[i], r[i + 1] }));
adj_row = add_or(Q);
}
{
vector<int> Q;
for (int i = 0;i < m - 1;i++) Q.push_back(add_and({ c[i], c[i + 1] }));
adj_col = add_or(Q);
}
add_or({ add_and({same_row, adj_col}), add_and({same_col, adj_row}) });
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1372 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
5 ms |
944 KB |
Output is correct |
8 |
Correct |
4 ms |
864 KB |
Output is correct |
9 |
Correct |
7 ms |
1372 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |