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 <iostream>
using namespace std;
#define pb push_back
const int N = 405;
int f(int w[], int x, int k){
vector<int> v;
for(int i = 0; i + k <= x; i++){
vector<int> l, r;
for(int j = 0; j <= i; j++) l.pb(w[j]);
for(int j = i + k; j <= x; j++) r.pb(w[j]);
vector<int> t;
t.pb(add_or(l)); t.pb(add_or(r));
v.push_back(add_and(t));
}
return add_or(v);
}
void construct_network(int H, int W, int K) {
int xpy[N], xmy[N];
vector<int> pv[N], mv[N];
for(int i = 0; i < H; i++) for(int j = 0; j < W; j++){
pv[i + j].pb(i * W + j);
mv[H - 1 - i + j].pb(i * W + j);
}
int X = H + W - 2;
for(int i = 0; i <= X; i++){
xpy[i] = add_or(pv[i]);
xmy[i] = add_or(mv[i]);
}
if(K == X){
int a = f(xpy, X, K);
int b = f(xmy, X, K);
vector<int> v;
v.pb(a); v.pb(b);
add_or(v);
return;
}
int a = f(xpy, X, K);
int A = f(xpy, X, K + 1);
int b = f(xmy, X, K);
int B = f(xmy, X, K + 1);
vector<int> v, t;
t.pb(a); t.pb(b); v.pb(add_or(t));
v.pb(add_not(A));
v.pb(add_not(B));
add_and(v);
}
# | 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... |