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;
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
const int MAXN = 500100;
int h, w, k;
bool grid[210][210];
int getId (int i, int j) {
return i*w + j;
}
vi getHalfCircle (int i, int j) {
vi ret;
FOR(x, 0, h-1) FOR(y, 0, w-1) {
if (x < i) continue;
if (x == i && y <= j) continue;
int d = abs(x-i) + abs(y-j);
if (d == k) ret.pb(getId(x,y));
}
return ret;
}
void construct_network(int H, int W, int K) {
h = H, w = W, k = K;
int s6 = add_and({getId(0,0)});
if (s6) {
vi circle = getHalfCircle (0,0);
int is = add_or(circle);
return;
}
vii black;
FOR(i, 0, h-1) FOR(j, 0, w-1) {
int is = add_and({getId(i,j)});
if (is) black.pb({i,j});
}
int d = abs (black[0].f - black[1].f) + abs(black[0].s - black[1].s);
if (d == k) add_not(getId(0,0));
else add_and({getId(0,0)});
}
/*
2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
out:
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
*/
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:44:13: warning: unused variable 'is' [-Wunused-variable]
44 | int is = add_or(circle);
| ^~
# | 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... |