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 OPTM ios_base::sync_with_stdio(0); cin.tie(0);
#define INF int(1e9+7)
#define ln '\n'
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define FOR(i,s,n) for (int i = s; i < n; i++)
#define FORR(i,n,s) for (int i = n; i > s; i--)
#define FORX(u, arr) for (auto u : arr)
#define PB push_back
#define F first
#define S second
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define UM unordered_map
#define US unordered_set
#define PQ priority_queue
#define ALL(v) v.begin(), v.end()
const ll LLINF = 1e18+1;
void construct_network(int H, int W, int K) {
int cur = H*W;
// everything
FOR(i,0,H) {
vector<int> v;
FOR(j,0,W) v.PB(i*W+j);
add_or(v);
cur++;
}
FOR(j,0,W) {
vector<int> v;
FOR(i,0,H) v.PB(i*W+j);
add_or(v);
cur++;
}
// row
int base = H*W;
FOR(i,1,H) {
FOR(j,0,H-i) {
vector<int> v = {base+j, base+j+i};
add_and(v);
cur++;
}
}
base = H*W+H+W;
int rst = cur;
vector<int> v;
FOR(i,0,H) v.PB(H*W+i);
add_xor(v);
cur++;
FOR(i,1,H) {
vector<int> v;
FOR(j,0,H-i) v.PB(base+j);
add_or(v);
cur++;
base += H-i;
}
int ren = cur;
// col
base = H*W+H;
FOR(i,1,W) {
FOR(j,0,W-i) {
vector<int> v = {base+j, base+j+i};
add_and(v);
cur++;
}
}
base = ren;
int cst = cur;
v.clear();
FOR(i,0,W) v.PB(H*W+H+i);
add_xor(v);
cur++;
FOR(i,1,W) {
vector<int> v;
FOR(j,0,W-i) v.PB(base+j);
add_or(v);
cur++;
base += W-i;
}
int cen = cur;
// sum
FOR(i,0,K+1) {
if (i > H-1 || K-i > W-1) continue;
vector<int> v = {rst+i, cst+K-i};
add_and(v);
cur++;
}
int sen = cur;
// final
v.clear();
FOR(i,cen,sen) v.PB(i);
add_or(v);
cur++;
}
# | 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... |