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;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 207;
vector <int> sv;
int r[N], c[N];
pair <int, int> ar, ac, case1, case2, case3, tmp, tp;
void construct_network(int H, int W, int K) {
if(H * W == 2){
if(K == 1) add_not(0);
else{
sv.pb(1);
add_and(sv);
}
return;
}
for(int i = 0; i < H; i++){
sv.clear();
for(int j = 0; j < W; j++){
sv.pb(i * H + j);
}
r[i] = add_and(sv);
}
for(int i = 0; i < W; i++){
sv.clear();
for(int j = 0; j < H; j++){
sv.pb(j * H + i);
}
c[i] = add_and(sv);
}
sv.clear();
for(int i = 0; i < H; i++){
sv.pb(H * W + i);
}
ar = mp(add_xor(sv), H * W + H + W);
sv.clear();
for(int i = 0; i < W; i++){
sv.pb(H * W + H + i);
}
ac = mp(add_xor(sv), H * W + H + W + 1);
int now = H * W + H + W + 2;
tmp = mp(add_not(ar.se), now++);
int st = now;
for(int i = 0; i + K - 1 < W; i++){
sv.clear();
sv.pb(H * W + H + i);
sv.pb(H * W + H + i + K - 1);
add_and(sv);
now++;
}
if(now == st) tp = mp(add_not(tmp.se), now++);
else{
sv.clear();
for(int i = st; i < now; i++){
sv.pb(i);
}
tp = mp(add_or(sv), now++);
}
sv.clear();
sv.pb(tmp.se), sv.pb(tp.se), sv.pb(ac.se);
case1 = mp(add_and(sv), now++);
tmp = mp(add_not(ac.se), now++);
st = now;
for(int i = 0; i + K - 1 < H; i++){
sv.clear();
sv.pb(H * W + i);
sv.pb(H * W + i + K - 1);
add_and(sv);
now++;
}
if(now == st) tp = mp(add_not(tmp.se), now++);
else{
sv.clear();
for(int i = st; i < now; i++){
sv.pb(i);
}
tp = mp(add_or(sv), now++);
}
sv.clear();
sv.pb(tmp.se), sv.pb(tp.se), sv.pb(ac.se);
case1 = mp(add_and(sv), now++);
}
# | 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... |