This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Challenge: Accepted
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r)cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
void construct_network(int H, int W, int K) {
vector<int> ask;
int cur = H*W;
for (int x = 0;x < H + W - 1;x++) {
ask.clear();
for (int i = 0;i < H;i++) {
int j = x - i;
if (j >= 0 && j < W) {
ask.push_back(i*W + j);
}
}
add_or(ask);
cur++;
}
for (int x = -H + 1;x < W;x++) {
ask.clear();
for (int i = 0;i < H;i++) {
int j = i + x;
if (j >= 0 && j < W) {
ask.push_back(i*W + j);
}
}
add_or(ask);
cur++;
}
auto id_ru = [&] (int x) {
return x + H*W;
};
auto id_dl = [&] (int x){
return x + H*W + H + W - 1;
};
vector<int> has;
for (int i = 0;i + K < H + W - 1;i++) {
ask.clear();
ask.push_back(id_ru(i));
ask.push_back(id_ru(i+K));
add_and(ask);
has.push_back(cur);
cur++;
}
int hask = cur-1;
for (int i = 0;i + K < H + W - 1;i++) {
ask.clear();
ask.push_back(id_dl(i));
ask.push_back(id_dl(i+K));
add_and(ask);
has.push_back(cur);
cur++;
}
add_or(has);
hask = cur++;
vector<int> check(1, hask);
for (int i = 0;i + K + 1 < H + W - 1;i++) {
ask.clear(), has.clear();
has.push_back(id_ru(i));
for (int j = i + K + 1;j < H + W - 1;j++) {
ask.push_back(id_ru(j));
}
add_or(ask);
has.push_back(cur);
cur++;
add_and(has);
add_not(cur);
check.push_back(cur + 1);
cur += 2;
ask.clear(), has.clear();
has.push_back(id_dl(i));
for (int j = i + K + 1;j < H + W - 1;j++) {
ask.push_back(id_dl(j));
}
add_or(ask);
has.push_back(cur);
cur++;
add_and(has);
add_not(cur);
check.push_back(cur + 1);
cur += 2;
}
add_and(check);
/*
std::vector<int> Ns;
Ns = {0, 1};
int a = add_and(Ns);
Ns = {0, a};
int b = add_or(Ns);
Ns = {0, 1, b};
int c = add_xor(Ns);
add_not(c);
*/
}
# | 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... |