// I can do all things through Christ who strenghthens me
// Philippians 4:13
#include "bits/stdc++.h"
#include "vision.h"
using namespace std;
#define REP(i, j, k) for (int i = j; i < (k); i++)
#define RREP(i, j, k) for (int i = j; i >= (k); i--)
template <class T>
inline bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int) x.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
#ifndef DEBUG
#define cerr if (0) cerr
#endif
const int INF = 1000000005;
const ll LINF = 1000000000000000005;
const int MAXN = 200005;
int h, w, k;
void construct_network(int H, int W, int K) {
h = H, w = W; k = K;
if (k == 1) {
int hs = h * w;
REP (i, 0, h) {
vi v(w);
iota(ALL(v), i * w);
add_or(v);
}
int ws = hs + w;
REP (j, 0, w) {
vi v;
REP (i, 0, h) {
v.pb(i * w + j);
}
add_or(v);
}
vi hall;
REP (i, 0, h - 1) {
hall.pb(add_and({hs + i, hs + i + 1}));
}
int hb = add_or(hall);
vi wall;
REP (i, 0, w - 1) {
wall.pb(add_and({ws + i, ws + i + 1}));
}
int wb = add_or(wall);
vi v1, v2;
REP (i, 0, h) {
REP (j, 0, w) {
if (i + j & 1) {
v1.pb(i * w + j);
} else {
v2.pb(i * w + j);
}
}
}
int t1 = add_or(v1), t2 = add_or(v2);
add_and({wb, hb, t1, t2});
return;
}
vi all;
REP (i, 0, h) {
REP (j, 0, w) {
if (max(h, w) > 30 && min(h, w) != 1 && j != 0) {
break;
}
vi v;
REP (ni, 0, h) {
if (abs(ni - i) > k) {
continue;
}
{
// abs(ni - i) + nj - j = k
// nj = k - abs(ni - i) + j
int nj = k - abs(ni - i) + j;
if (nj >= 0 && nj < w) {
v.pb(ni * w + nj);
}
}
}
if (v.empty()) {
continue;
}
int tmp = add_or(v);
all.pb(add_and({i * w + j, tmp}));
}
}
add_or(all);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:71:23: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
71 | if (i + j & 1) {
| ~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
1668 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |