#include <bits/stdc++.h>
#define pb push_back
#include "vision.h"
using namespace std;
void construct_network(int H, int W, int K) {
vector<int> c[2];
for(int i=0;i<H;i++){
vector<int> d;
for(int j=0;j<W;j++){
d.pb(i*W+j);
}
c[0].pb(add_or(d));
}
// H query
for(int i=0;i<W;i++){
vector<int> d;
for(int j=0;j<H;j++){
d.pb(j*W+i);
}
c[1].pb(add_or(d));
}
// W query
vector<int> e[2][8];
int f[2][8];
for(int i=0;i<H;i++){
vector<int> d[8];
for(int j=i+1;j<H;j++){
for(int z=0;z<8;z++){
if(((j-i)&(1<<z))){
d[z].pb(j);
}
}
}
for(int j=0;j<8;j++){
e[0][j].pb(add_and({c[0][i],add_or(d[j])}));
}
}
// H*8*2 query
for(int i=0;i<W;i++){
vector<int> d[8];
for(int j=i+1;j<W;j++){
for(int z=0;z<8;z++){
if(((j-i)&(1<<z))){
d[z].pb(j);
}
}
}
for(int j=0;j<8;j++){
e[1][j].pb(add_and({c[1][i],add_or(d[j])}));
}
}
// W*8*2 query
for(int i=0;i<8;i++){
f[0][i]=add_or(e[0][i]);
f[1][i]=add_or(e[1][i]);
}
// 8*2 query
vector<int> res;
for(int i=0;i<=K;i++){
vector<int> d1,d2;
for(int j=0;j<8;j++){
if((i&(1<<j))){
d1.pb(f[0][j]);
}
else{
d2.pb(f[0][j]);
}
}
int h1,h2;
if(i==0){
h1=add_not(add_or(d2));
}
else{
h1=add_and({add_and(d1),add_not(add_or(d2))});
}
int num=K-i;
d1.clear();
d2.clear();
for(int j=0;j<8;j++){
if((num&(1<<j))){
d1.pb(f[1][j]);
}
else{
d2.pb(f[1][j]);
}
}
if(num==0){
h2=add_not(add_or(d2));
}
else{
h2=add_and({add_and(d1),add_not(add_or(d2))});
}
res.pb(add_and({h1,h2}));
}
add_or(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
856 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |