#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int cell(int i, int j, int m){
return i * m + j;
}
void construct_network(int n, int m, int k) {
// std::vector<int> Ns;
// Ns = {0, 1};
// int a = add_and(Ns);
// Ns = {0, a};
// int b = add_or(Ns);
// Ns = {0, 1, b};
// int c = add_xor(Ns);
// add_not(c);
vector <int> r, r2;
vector <int> a;
for (int i = 0; i < n; i++){
a.clear();
for (int j = 0; j < m; j++) a.push_back(cell(i, j, m));
int x = add_xor(a);
r.push_back(x);
if (i != n - 1){
a.clear();
for (int j = 0; j < m; j++) {
a.push_back(cell(i, j, m));
a.push_back(cell(i + 1, j, m));
}
x = add_xor(a);
r2.push_back(x);
}
}
vector <int> c, c2;
for (int j = 0; j < m; j++){
a.clear();
for (int i = 0; i < n; i++) a.push_back(cell(i, j, m));
int x = add_xor(a);
c.push_back(x);
if (j != m - 1){
a.clear();
for (int i = 0; i < n; i++){
a.push_back(cell(i, j, m));
a.push_back(cell(i, j + 1, m));
}
x = add_xor(a);
c2.push_back(x);
}
}
// return;
int x;
a.clear();
for (auto &x : r){
a.push_back(x);
x = add_xor(a);
}
a.clear();
for (auto &x : r2){
a.push_back(x);
x = add_xor(a);
}
a.clear();
for (auto &x : c){
a.push_back(x);
x = add_xor(a);
}
a.clear();
for (auto &x : c2){
a.push_back(x);
x = add_xor(a);
}
// return;
int v[4];
v[0] = add_or(r);
if (n > 1)
v[1] = add_or(r2);
else v[1] = -1;
v[2] = add_or(c);
if (m > 1)
v[3] = add_or(c2);
else v[3] = -1;
vector <int> pos;
for (int i = 0; i < 4; i++){
for (int j = i + 1; j < 4; j++){
if (v[i] == -1 || v[j] == -1) continue;
x = add_and({v[i], v[j]});
pos.push_back(x);
}
}
add_or(pos);
}
# |
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 |
4 ms |
596 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, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
3448 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 |
- |