This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K)
{
vector<int> rw(H), cl(W);
vector<int> conr(H - 1), conc(W - 1);
for (int i = 0; i < H; i++)
{
vector<int> v;
for (int j = 0; j < W; j++) v.push_back(i * W + j);
rw[i] = add_xor(v);
if (i) conr[i - 1] = add_and({rw[i], rw[i - 1]});
}
for (int j = 0; j < W; j++)
{
vector<int> v;
for (int i = 0; i < H; i++) v.push_back(i * W + j);
cl[j] = add_xor(v);
if (j) conc[j - 1] = add_and({cl[j], cl[j - 1]});
}
if (H == 1)
{
add_or(conc);
}
else if (W == 1)
{
add_or(conr);
}
else if (H > 1 && W > 1)
{
int A = add_or(rw), B = add_or(cl);
int x = add_and({add_not(A), add_or(conc)});
int y = add_and({add_not(B), add_or(conr)});
add_or({x, y});
}
}
# | 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... |