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>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
#define pb push_back
using namespace std;
vector<int> q;
int cur,k,h,w;
void check(int x,int y)
{
//if(x==2&&y==2)cout<<": ";
vector<int>qq;
for(int i=0;i<=k;i++)
{
int j=k-i;
if(!(j+y>=w||i+x>=h))qq.push_back((i+x)*w+j+y);
if((y-j>=0&&i+x<h)&&i!=0)qq.push_back((i+x)*w+y-j);
}
//cout<<x<<" "<<y<<": ";for(int i=0;i<qq.size();i++)cout<<qq[i]<<" ";cout<<"\n";
if(qq.size()==0)return;
add_or(qq);
cur++;
add_and({cur-1,x*w+y});
q.push_back(cur);
cur++;
}
void construct_network(int hh, int ww, int kk)
{
w=ww;h=hh;k=kk;
cur=h*w;
if(min(h,w)==1)
{
int mx=max(h,w);
for(int i=0;i<mx-k;i++)
{
add_and({i,i+k});
q.push_back(mx+i);
}
add_or(q);
return;
}
else if(max(h,w)<=100)
{
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
check(i,j);
}
}
add_or(q);
}
else
{
for(int i=0;i<=k;i++)
{
int j=k-i;
if(j>=w||i>=h)continue;
q.push_back(i*w+j);
}
add_or(q);
}
}
# | 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... |