이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <vector>
using namespace std;
int check(int H, int W, int K) //check if dist <= K
{
vector<int> main_list[450];
vector<int>* opp_list = (new vector<int>[500] + 225);
for(int i = 0; i < H*W; i++)
{
main_list[i/W + int(i%W)].push_back(i);
opp_list[i/W - int(i%W)].push_back(i);
}
int main_onecell[450];
int main_twocell[450];
int main_block[450];
vector<int> main_check;
for(int d = 0; d <= H-1 + W-1; d++)
{
main_onecell[d] = add_or(main_list[d]);
main_twocell[d] = add_and({main_onecell[d], add_not(add_xor(main_list[d]))});
}
for(int d = 0; d+K <= H-1 + W-1; d++)
{
vector<int> lst;
vector<int> twocellcheck;
for(int d1 = d; d1 <= d+K; d1++)
{
lst.push_back(main_onecell[d1]);
twocellcheck.push_back(main_twocell[d1]);
}
twocellcheck.push_back(add_and({add_or(lst), add_not(add_xor(lst))}));
main_block[d] = add_or(twocellcheck);
main_check.push_back(main_block[d]);
}
int* opp_onecell = new int[450] + 225;
int* opp_twocell= new int[450] + 225;
int* opp_block = new int[450] + 225;
vector<int> opp_check;
for(int d = 0 - (W-1); d <= (H+1) - 0; d++)
{
opp_onecell[d] = add_or(opp_list[d]);
opp_twocell[d] = add_and({opp_onecell[d], add_not(add_xor(opp_list[d]))});
}
for(int d = 0 - (W-1); d+K <= (H+1) - 0; d++)
{
vector<int> lst;
vector<int> twocellcheck;
for(int d1 = d; d1 <= d+K; d1++)
{
lst.push_back(opp_onecell[d1]);
twocellcheck.push_back(opp_twocell[d1]);
}
twocellcheck.push_back(add_and({add_or(lst), add_not(add_xor(lst))}));
opp_block[d] = add_or(twocellcheck);
opp_check.push_back(opp_block[d]);
}
return add_and({add_or(main_check), add_or(opp_check)});
}
void construct_network(int H, int W, int K)
{
if(K == 1) check(H, W, K);
else add_and({check(H, W, K), add_not(check(H, W, K-1))});
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |