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;
struct point{
int x, y, k;
};
point a, b;
void bin_search(int st, int dr, int n, int m){
if(st == dr){
point c;
c.x = st / m;
c.y = st % m;
c.k = 1;
if(a.k == 0) a = c;
else b = c;
return ;
}
int mij = (st + dr) / 2;
vector <int> left, right;
for(int i = st; i <= mij ; ++i) left.push_back(i);
for(int i = mij + 1; i <= dr ; ++i) right.push_back(i);
int am_left = add_or(left);
int am_right = add_or(right);
if(am_left) bin_search(st, mij, n, m);
if(am_right) bin_search(mij + 1, dr, n, m);
}
void construct_network(int H, int W, int K) {
bin_search(0, H * W - 1, H, W);
if(abs(a.x - b.x) + abs(a.y - b.y) == K){
vector <int> v;
v.push_back(a.x * W + a.y);
add_or(v);
}
else add_not(a.x * W + a.y);
return ;
}
# | 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... |