#include <bits/stdc++.h>
using namespace std;
int add_and(std::vector<int> Ns);
int add_or(std::vector<int> Ns);
int add_xor(std::vector<int> Ns);
int add_not(int N);
void construct_network(int H, int W, int K) {
int l = H*W;
for(int i = 0; i < H; i++) {
vector<int> r(W);
iota(r.begin(), r.end(), i*W);
add_or(r); l++;
}
for(int i = 0; i < W; i++) {
vector<int> r(H);
for (int j = i, k = 0; k < H; j+= W, k++) {
r[k] = j;
}
add_or(r); l++;
}
int s = l;
for(int i = 0; i < H-1; i++) {
vector<int> r = {H*W+i, H*W+i+1};
add_and(r); s++;
}
for(int i = 0; i < W-1; i++) {
vector<int> r = {H*(W+1)+i, H*(W+1)+i+1};
add_and(r); s++;
}
vector<int> ans;
for (int i = l; i < s; i++) ans.push_back(i);
add_or(ans);
s++; l = s;
for(int i = 0; i < W; i++) {
vector<int> r(H);
for (int j = i, k = 0; k < H; j+= W, k++) {
r[k] = j;
}
add_xor(r); l++;
}
int ll = l;
for(int i = 0; i < H; i++) {
vector<int> r(W);
iota(r.begin(), r.end(), i*W);
add_xor(r); ll++;
}
ans.clear();
for (int i = s; i < l; i++) ans.push_back(i);
add_or(ans); // ll
ans.clear();
for (int i = l; i < ll; i++) ans.push_back(i);
add_or(ans); //ll+1
add_xor({ll, ll+1}); //ll+2
add_and({s-1, ll+2});
}
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1972 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
436 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
8 ms |
1116 KB |
Output is correct |
8 |
Correct |
4 ms |
1112 KB |
Output is correct |
9 |
Correct |
14 ms |
1956 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
- |