#include <bits/stdc++.h>
// mrrrow meeow :3
// go play vivid/stasis now! https://vividstasis.gay
#define fo(i, a, b) for (auto i = (a); i < (b); i++)
#define of(i, a, b) for (auto i = (b); i-- > (a);)
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define be(a) a.begin(), a.end()
using namespace std;
int ____init = [] {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
return 0;
}();
int add_not(int N);
int add_and(vector<int> Ns);
int add_or(vector<int> Ns);
int add_xor(vector<int> Ns);
void construct_network(int h, int w, int k) {
vector<int> rdo, rdx, rdt;
of(i, 0, h) {
vector<int> inputs;
for (int r = i, c = 0; r < h && c < w; r++, c++) inputs.pb(r * w + c);
rdo.pb(add_or(inputs));
rdx.pb(add_xor(inputs));
inputs.pb(rdo.back());
rdt.pb(add_xor(inputs));
}
fo(i, 1, w) {
vector<int> inputs;
for (int r = 0, c = i; r < h && c < w; r++, c++) inputs.pb(r * w + c);
rdo.pb(add_or(inputs));
rdx.pb(add_xor(inputs));
inputs.pb(rdo.back());
rdt.pb(add_xor(inputs));
}
vector<int> ldo, ldx, ldt;
fo(i, 0, w) {
vector<int> inputs;
for (int r = 0, c = i; r < h && c >= 0; r++, c--) inputs.pb(r * w + c);
ldo.pb(add_or(inputs));
ldx.pb(add_xor(inputs));
inputs.pb(ldo.back());
ldt.pb(add_xor(inputs));
}
fo(i, 1, h) {
vector<int> inputs;
for (int r = i, c = w - 1; r < h && c >= 0; r++, c--) inputs.pb(r * w + c);
ldo.pb(add_or(inputs));
ldx.pb(add_xor(inputs));
inputs.pb(ldo.back());
ldt.pb(add_xor(inputs));
}
vector<int> kordt;
fo(i, 0, rdo.size() - k) {
vector<int> inputs;
fo(j, 0, k + 1) inputs.pb(rdo[i + j]);
inputs.pb(add_or(inputs));
fo(j, 0, k + 1) inputs.pb(rdt[i + j]);
kordt.pb(add_xor(inputs));
}
vector<int> krdt;
fo(i, 0, rdo.size() - k + 1) {
vector<int> inputs;
fo(j, 0, k) inputs.pb(rdo[i + j]);
inputs.pb(add_or(inputs));
fo(j, 0, k) inputs.pb(rdt[i + j]);
krdt.pb(add_xor(inputs));
}
vector<int> koldt;
fo(i, 0, ldo.size() - k) {
vector<int> inputs;
fo(j, 0, k + 1) inputs.pb(ldo[i + j]);
inputs.pb(add_or(inputs));
fo(j, 0, k + 1) inputs.pb(ldt[i + j]);
koldt.pb(add_xor(inputs));
}
vector<int> kldt;
fo(i, 0, ldo.size() - k + 1) {
vector<int> inputs;
fo(j, 0, k) inputs.pb(ldo[i + j]);
inputs.pb(add_or(inputs));
fo(j, 0, k) inputs.pb(ldt[i + j]);
kldt.pb(add_xor(inputs));
}
add_and({add_and({add_or(kordt), add_or(koldt)}), add_not(add_and({add_or(krdt), add_or(kldt)}))});
}
# | 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... |