#include <bits/stdc++.h>
using namespace std;
int add_not (int n);
int add_and (vector <int> n);
int add_or (vector <int> n);
int add_xor (vector <int> n);
void construct_network (int h, int w, int k){
vector <int> idx, idx1, last;
int curr, curr1;
for (int i = 0; i < h; i ++){
for (int j = 0; j < w; j ++) idx.push_back (i * w + j);
add_or (idx);
idx.clear ();
}
for (int i = 0; i < h; i ++) idx.push_back (h * w + i);
idx1.push_back (add_xor (idx));
idx.clear ();
for (int i = 0; i < h - k; i ++){
for (int j = 0; j <= k; j ++) idx.push_back (h * w + i + j);
add_or (idx);
add_xor (idx);
curr = add_not (add_xor (idx));
idx1.push_back (add_and ({curr - 2, curr}));
idx.clear ();
}
curr1 = add_or (idx1);
last.push_back (curr1);
idx1.clear ();
for (int i = 0; i < w; i ++){
for (int j = 0; j < h; j ++) idx.push_back (j * w + i);
add_or (idx);
idx.clear ();
}
for (int i = 0; i < w; i ++) idx.push_back (curr1 + i);
idx1.push_back (add_xor (idx));
idx.clear ();
for (int i = 0; i < w - k; i ++){
for (int j = 0; j <= k; j ++) idx.push_back (curr1 + i + j);
add_or (idx);
add_xor (idx);
curr = add_not (add_xor (idx));
idx1.push_back (add_and ({curr - 2, curr}));
idx.clear ();
}
curr1 = add_or (idx1);
last.push_back (curr1);
idx1.clear ();
for (int i = 1 - w; i < h; i ++){
for (int j = 0; j < h; j ++) if (j - i >= 0 && j - i < w) idx.push_back (j * w + j - i);
add_or (idx);
idx.clear ();
}
int n = h + w - 1;
for (int i = 0; i < n - k; i ++){
idx1.push_back (add_and ({curr1 + i, curr1 + i + k}));
}
curr1 = add_or (idx1);
idx1.clear ();
for (int i = 0; i < n; i ++){
for (int j = 0; j < h; j ++) if (i - j >= 0 && i - j < w) idx.push_back (j * w + i - j);
add_or (idx);
idx.clear ();
}
for (int i = 0; i < n - k; i ++){
idx1.push_back (add_and ({curr1 + i, curr1 + i + k}));
}
last.push_back (add_or ({curr1, add_or (idx1)}));
add_and (last);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
on inputs (0, 197), (0, 198), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 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 |
2072 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
on inputs (0, 1), (0, 2), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |