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 <vector>
#include <iostream>
using namespace std;
int n,m,i,j,k,wh;
vector<int> v,fin;
int enc(int A,int B)
{
return (m*A+B);
}
void construct_network(int H, int W, int K) {
n=H,m=W;wh=n*m-1;
fin.clear();
for(i=0;i<H;i++)
for(j=0;j<W;j++)
{
v.clear();
for(k=0;k<=K;k++)
{
if(i+k<H&&j+K-k<W)
{
v.push_back(enc(i+k,j+K-k));
}
if(k>=1&&i-k>=0&&j+K-k<W)
{
v.push_back(enc(i-k,j+K-k));
}
}
if(v.size())
{
if(v.size()>1)
{
add_or(v);
wh++;
v.clear();v.push_back(enc(i,j));v.push_back(wh);
}
else
{
v.push_back(enc(i,j));
}
wh++;
add_and(v);
fin.push_back(wh);
}
}
add_or(fin);
}
# | 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... |