#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void construct_network(int H, int W, int K){
int d = H+W-1, mhw = min(H, W);
vector<int> d1v;
d1v.reserve(d);
for(int i=0; i<d; i++){
vector<int> cur;
for(int j=0; j<mhw; j++){
int ch = j, cw = i-j;
if(ch > -1 && ch < H && cw > -1 && cw < W){
cur.pb(cw + ch*W);
}
}
d1v.pb(add_or(cur));
}
vector<int> d2v;
d2v.reserve(d);
for(int i=0; i<d; i++){
vector<int> cur;
for(int j=0; j<mhw; j++){
int ch = j, cw = W-1-i+j;
if(ch > -1 && ch < H && cw > -1 && cw < W){
cur.pb(cw + ch*W);
}
}
d2v.pb(add_or(cur));
}
vector<int> k1v, k2v, j1v, j2v;
vector<int> pro;
for(int i=0; i<K; i++){
pro.pb(d1v[i]);
}
for(int j=K; j<d; j++){
pro.pb(d1v[j]);
k1v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
pro.erase(pro.begin());
}
pro.clear();
for(int i=0; i<K; i++){
pro.pb(d2v[i]);
}
for(int j=K; j<d; j++){
pro.pb(d2v[j]);
k2v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
pro.erase(pro.begin());
}
pro.clear();
for(int i=0; i<K-1; i++){
pro.pb(d1v[i]);
}
for(int j=K-1; j<d; j++){
pro.pb(d1v[j]);
j1v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
pro.erase(pro.begin());
}
pro.clear();
for(int i=0; i<K-1; i++){
pro.pb(d2v[i]);
}
for(int j=K-1; j<d; j++){
pro.pb(d2v[j]);
j2v.pb(add_and({add_or(pro), add_not(add_xor(pro))}));
pro.erase(pro.begin());
}
pro.clear();
int k1 = add_or(k1v), k2 = add_or(k2v), j1 = add_or(j1v), j2 = add_or(j2v);
int nc = add_and({add_not(k1), add_not(k2)}), c1 = add_and({k1, add_not(j1)}), c2 = add_and({k2, add_not(j2)});
cerr << nc << ' ' << c1 << ' ' << c2 << '\n';
add_and({add_not(nc), add_or({c1, c2})});
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
600 KB |
Output is correct |
2 |
Correct |
7 ms |
1116 KB |
Output is correct |
3 |
Correct |
8 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Incorrect |
1 ms |
348 KB |
WA in grader: Instruction with no inputs |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1752 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 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |