This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;
#ifndef WAIMAI
#include "vision.h"
#else
#include "grader.cpp"
#endif
#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
const int SIZE = 205;
int xid[SIZE], yid[SIZE], p[9];
void construct_network(int n, int m, int k) {
auto id = [&](int x, int y) {
return x * m + y;
};
FOR (i, 0, n - 1) {
vector<int> ids;
FOR (j, 0, m - 1) ids.pb(id(i, j));
xid[i] = add_xor(ids);
}
FOR (j, 0, m - 1) {
vector<int> ids;
FOR (i, 0, n - 1) ids.pb(id(i, j));
yid[j] = add_xor(ids);
}
int zero, one, ans;
{
vector<int> ids;
FOR (i, 0, n - 1) ids.pb(xid[i]);
FOR (j, 0, m - 1) ids.pb(yid[j]);
zero = add_xor(ids);
one = add_not(zero);
ans = add_and({zero});
}
int cur = add_and({zero});
auto work = [&](int x) {
cur = add_xor({cur, x});
x = add_and({cur});
FOR (i, 0, 8) {
int x0;
x0 = add_xor({p[i], x});
if (i < 8) x = add_and({p[i], x});
p[i] = x0;
}
};
FOR (i, 0, 8) p[i] = add_and({zero});
FOR (i, 0, n - 1) work(xid[i]);
FOR (j, 0, m - 1) work(yid[j]);
FOR (i, 0, 8) ans = add_or({ans, add_xor({p[i], (k >> i & 1 ? one : zero)})});
ans = add_not(ans);
}
/*
in1
2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
out1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
*/
# | 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... |