#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;
/*
0 -> H - 1 : is one in this row
H -> H + W - 1 : is one in this col
H + W -> both in same row
H + W + 1 -> H + W + W - 1 : in adj columns for I
H + W + W : in adj columns
H + W + W + 1 : case 1 ans
H + W + W + 2 : both in same col
H + W + W + 3 -> H + H + W + W + 1 : in adj rows for I
H + H + W + W + 2 : in adj rows
H + H + W + W + 3 : case 2 ans
H + H + W + W + 4 : overall ans
*/
void construct_network(int H, int W, int K) {
int cnt = 0;
// + H
for (int i = 0; i < H; i++) {
vi cur;
for (int j = 0; j < W; j++) cur.push_back(i * W + j);
add_or(cur);
cnt++;
}
// + W
for (int i = 0; i < W; i++) {
vi cur;
for (int j = 0; j < H; j++) cur.push_back(j * W + i);
add_or(cur);
cnt++;
}
// both in same row
// + 1
vi x;
for (int i = 0; i < H; i++) x.push_back(H * W + i);
add_xor(x);
cnt++;
/*
// both in adj col for I
// + W - 1
x.clear();
for (int i = 0; i < W - 1; i++) {
add_and({H * W + H + i, H * W + H + i + 1});
cnt++;
}
// both actually in adj col
// + 1
vi t;
for (int i = H + W + 1; i <= H + W + W - 1; i++) t.push_back(H * W + i);
add_xor(t);
cnt++;
// case 1 ans
// + 1
add_and({H + W, H + W + W});
cnt++;
// both in same col
// + 1
x.clear();
for (int i = H; i <= H + W - 1; i++) x.push_back(H * W + i);
add_xor(x);
cnt++;
// both in adj row for I
// + H - 1
x.clear();
for (int i = 0; i < H - 1; i++) {
add_and({H * W + i, H * W + i + 1});
cnt++;
}
// both actually in adj row
// + W - 1
t.clear();
for (int i = H + W + W + 3; i <= H + H + W + W + 1; i++) t.push_back(H * W + i);
add_xor(t);
cnt++;
// case 2 ans
add_and({H + H + W + W + 2, H + W + W + 2});
cnt++;
// overall ans
add_or({H + W + W + 1, H + H + W + W + 3});
*/
}
# | 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... |