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<bits/stdc++.h>
#include "vision.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
void construct_network(int H,int W,int K){
vector<int>row,col;
int cur=H*W;
for(int i=0;i<H;i++){
vector<int>Ns;
for(int j=0;j<W;j++){
Ns.pb(i*W+j);
}
int a=add_or(Ns);
cur++;
if(a==1){
row.pb(i);
}
}
for(int j=0;j<W;j++){
vector<int>Ns;
for(int i=0;i<H;i++){
Ns.pb(i*W+j);
}
int a=add_or(Ns);
cur++;
if(a==1){
col.pb(j);
}
}
if(row.size()==2&&col.size()==2){
add_and({row[0]+W+col[0],row[1]+W+col[1]});
add_and({row[0]+W+col[1],row[1]+W+col[0]});
add_or({cur,cur+1});
}
else if(row.size()==2&&col.size()==1){
add_and({row[0]+W+col[0],row[1]+W+col[0]});
}
else{
add_and({row[0]+W+col[1],row[0]+W+col[1]});
}
}
# | 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... |