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>
using namespace std;
#define ll long long
#define pld pair<long double, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define ff first
#define ss second
#define SZ(x) ((int)(x).size())
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int add_and(vector<int> Ns);
int add_or(vector<int> Ns);
int add_xor(vector<int> Ns);
int add_not(int N);
int H, W;
bool valid(int x, int y){
return (x >= 0 && x < H && y >= 0 && y < W);
}
const int MAXN = 200*200+1000;
int cnt;
bool vis[MAXN][MAXN];
vector<int> OR;
void f(int i, int j, int i2, int j2){
if(!valid(i2, j2)) return;
int c1 = W*i+j, c2 = W*i2+j2;
if(vis[c1][c2] || vis[c2][c1]) return;
vis[c1][c2] = vis[c2][c1] = true;
OR.pb(c2);
}
vector<int> all;
void construct_network(int H, int W, int K){
::H = H, ::W = W;
cnt = H*W;
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
for(int k = 0; k <= K; k++){
int i2, j2;
i2 = i + k;
j2 = j + K - k;
f(i, j, i2, j2);
j2 = j - (K - k);
f(i, j, i2, j2);
i2 = i - k;
j2 = j + K - k;
f(i, j, i2, j2);
j2 = j - (K - k);
f(i, j, i2, j2);
if(!SZ(OR)) continue;
add_or(OR);
OR.clear();
vector<int> v(2);
v[0] = cnt++;
v[1] = W*i+j;
add_and(v);
all.pb(cnt++);
}
}
}
add_or(all);
}
# | 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... |