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;
typedef pair<int,int> pii; //(x,y)
int h,w,k;
vector<int> a[400],b[400];
int cor(pii c) {return c.first*w+c.second;}
int check(int p) {
vector<int> v;
for (int i=0; i<h+w-1; ++i) {
vector<int> temp;
for (int j=i; j<=min(i+p,h+w-2); ++j) {
for (auto s : a[j]) temp.push_back(s);
}
int x=add_or(temp), y=add_xor(temp);
y=add_not(y);
x=add_and({x,y});
v.push_back(x);
}
int fir=add_or(v);
v.clear();
for (int i=0; i<h+w-1; ++i) {
vector<int> temp;
for (int j=i; j<=min(i+p,h+w-2); ++j) {
for (auto s : b[j]) temp.push_back(s);
}
int x=add_or(temp), y=add_xor(temp);
y=add_not(y);
x=add_and({x,y});
v.push_back(x);
}
int sec=add_or(v);
return add_and({fir,sec});
}
void construct_network(int H, int W, int K) {
h=H; w=W; k=K;
for (int i=0; i<h; ++i) {
for (int j=0; j<w; ++j) {
a[i+j].push_back(cor({i,j}));
b[i-j+w-1].push_back(cor({i,j}));
}
}
int x=check(k), y=check(k-1);
y=add_not(y);
add_and({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... |