#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int Lg = 8;
int h , w , k , ONE , ZERO;
vector <int> one(vector <int> vec)
{
vector <int> res;
int n = vec.size();
for(int i = 0 ; i < Lg ; i++)
{
vector <int> all;
for(int j = 0 ; j < n ; j++)
{
vector <int> ask;
for(int x = j + 1 ; x < n ; x++) if(((x - j) >> i) & 1)
ask.push_back(vec[x]);
if(ask.empty())
{
all.push_back(ZERO);
continue;
}
int a = add_or(ask);
ask = {vec[j] , a};
all.push_back(add_and(ask));
}
res.push_back(add_or(all));
}
return res;
}
int pos(int x , int y)
{
return x * w + y;
}
void construct_network(int H, int W, int K)
{
h = h;
w = w;
k = k;
vector <int> tmp;
for(int i = 0 ; i < h ; i++) for(int j = 0 ; j < w ; j++)
tmp.push_back(pos(i , j));
ONE = add_or(tmp);
ZERO = add_not(ONE);
vector <int> cmpr;
for(int i = 0 ; i < h ; i++)
{
vector <int> ask;
for(int j = 0 ; j < w ; j++)
ask.push_back(pos(i , j));
cmpr.push_back(add_or(ask));
}
vector <int> R = one(cmpr);
vector <int> notR;
for(auto u : R)
notR.push_back(add_not(u));
vector <int> cmpc;
for(int j = 0 ; j < w ; j++)
{
vector <int> ask;
for(int i = 0 ; i < h ; i++)
ask.push_back(pos(i , j));
cmpc.push_back(add_or(ask));
}
vector <int> C = one(cmpc);
vector <int> notC;
for(auto u : C)
notC.push_back(add_not(u));
vector <int> all;
for(int r = 0 ; r < h ; r++)
{
int c = k - r;
if(c >= w)
{
all.push_back(ZERO);
continue;
}
vector <int> ask;
for(int i = 0 ; i < Lg ; i++)
{
if((c >> i) & 1)
ask.push_back(C[i]);
else
ask.push_back(notC[i]);
if((r >> i) & 1)
ask.push_back(R[i]);
else
ask.push_back(notR[i]);
}
all.push_back(add_and(ask));
}
add_or(all);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |