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>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
void construct_network(int H, int W, int K) {
map<int, vector<int>> diapos;
map<int, vector<int>> dianeg;
for(int i = 0; i < H; ++i)
for(int j = 0; j < W; ++j){
diapos[i+j].pb(i*W+j);
dianeg[i-j].pb(i*W+j);
}
for(auto & u : diapos)
u.ss.pb(add_or(u.ss));
for(auto & u : dianeg)
u.ss.pb(add_or(u.ss));
vector<int> v1;
for(auto u : diapos)
if(u.ss.size() && diapos[u.ff+K].size())
v1.pb( add_and( {u.ss.back(), diapos[u.ff+K].back()} ) );
assert(v1.size());
int samepos = add_or(v1);
vector<int> v2;
for(auto u : dianeg)
if(u.ss.size() && dianeg[u.ff+K].size())
v2.pb( add_and( {u.ss.back(), dianeg[u.ff+K].back()} ) );
assert(v2.size());
int sameneg = add_or(v2);
vector<int> rowcol;
for(int i = 0; i < H; ++i){
vector<int> vec;
for(int j = 0; j < W; ++j)
vec.pb(i*W+j);
rowcol.pb(add_and({add_or(vec), add_not(add_xor(vec))}));
}
for(int j = 0; j < W; ++j){
vector<int> vec;
for(int i = 0; i < H; ++i)
vec.pb(i*W+j);
rowcol.pb(add_and({add_or(vec), add_not(add_xor(vec))}));
}
int samerow = add_or(rowcol);
int samewin = add_and({samerow, samepos, sameneg});
int difwin = add_and( { add_not(samerow), add_xor({samepos, sameneg}) } );
add_or({samewin, difwin});
}
# | 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... |