#include <bits/stdc++.h>
using namespace std;
#define pb push_back
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);
int transformCoords(int W, int i, int j) {
return i*W+j;
}
bool isValid(int H, int W, int i, int j) {
if (i < 0 || j < 0 || i >= H || j >= W) return false;
return true;
}
int idx;
int calc1(int H, int W) {
vector<int> Ns;
// int idx = H*W;
for (int i = 0; i < H; i++) {
vector<int> arr;
for (int j = 0; j < W; j++) arr.pb(i*W+j);
add_or(arr);
idx++;
}
for (int i = 0; i < H-1; i++) {
add_and({idx-H+i, idx-H+i+1});
Ns.pb(idx);
idx++;
}
int consecOr1 = add_or(Ns);
idx++;
Ns = vector<int>(Ns);
for (int i = 0; i < W; i++) {
vector<int> arr;
for (int j = 0; j < H; j++) arr.pb(j*W+i);
add_or(arr);
add_xor(arr);
add_xor({idx, idx+1});
Ns.pb(idx+2);
idx+=3;
}
int consecXor1 = add_or(Ns);
idx += 2;
return add_and({consecOr1, consecXor1});
}
int calc2(int H, int W) {
vector<int> Ns;
// int idx = H*W;
for (int i = 0; i < W; i++) {
vector<int> arr;
for (int j = 0; j < H; j++) arr.pb(j*W+i);
add_or(arr);
idx++;
}
for (int i = 0; i < W-1; i++) {
add_and({idx-W+i, idx-W+i+1});
Ns.pb(idx);
idx++;
}
int consecOr1 = add_or(Ns);
idx++;
Ns = vector<int>(Ns);
for (int i = 0; i < H; i++) {
vector<int> arr;
for (int j = 0; j < W; j++) arr.pb(i*W+j);
add_or(arr);
add_xor(arr);
add_xor({idx, idx+1});
Ns.pb(idx+2);
idx+=3;
}
int consecXor1 = add_or(Ns);
idx += 2;
return add_and({consecOr1, consecXor1});
}
void construct_network(int H, int W, int K) {
idx = H*W;
add_or({calc1(H, W), calc2(H, W)});
// cout << idx << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
2688 KB |
on inputs (14, 10), (15, 8), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |