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"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
#define ffor(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()
void construct_network(int H, int W, int K) {
map<int, vii> diaga, diagb;
rep(i, H) {
rep(j, W) {
int k = W * i + j;
diaga[i + j].emplace_back(k);
diagb[i - j].emplace_back(k);
}
}
vii inda, indb, res;
forin(diag, diaga) {
inda.emplace_back(add_or(diag.second));
}
forin(diag, diagb) {
indb.emplace_back(add_or(diag.second));
}
vii deltaa, deltab;
vii dkaa, dkbb, ckaa = {add_xor(inda)}, ckbb = {add_xor(indb)};
rep(i, inda.size() - K) {
dkaa.emplace_back(add_and({inda[i], inda[i + K]}));
vii curr;
ffor(j, i, i + K + 1) {
curr.emplace_back(inda[j]);
}
int pres = add_or(curr);
int odd = add_not(add_xor(curr));
ckaa.emplace_back(add_and({pres, odd}));
}
rep(i, indb.size() - K) {
dkbb.emplace_back(add_and({indb[i], indb[i + K]}));
vii curr;
ffor(j, i, i + K + 1) {
curr.emplace_back(indb[j]);
}
int pres = add_or(curr);
int odd = add_not(add_xor(curr));
ckbb.emplace_back(add_and({pres, odd}));
}
int dka = add_or(dkaa), dkb = add_or(dkbb), cka = add_or(ckaa), ckb = add_or(ckbb);
add_and({add_or({dka, dkb}), cka, ckb});
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:19:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define ffor(i, a, b) for (ll i = a; i < b; i++)
| ^
vision.cpp:20:19: note: in expansion of macro 'ffor'
20 | #define rep(i, n) ffor(i, 0, n)
| ^~~~
vision.cpp:42:2: note: in expansion of macro 'rep'
42 | rep(i, inda.size() - K) {
| ^~~
vision.cpp:19:40: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | #define ffor(i, a, b) for (ll i = a; i < b; i++)
| ^
vision.cpp:20:19: note: in expansion of macro 'ffor'
20 | #define rep(i, n) ffor(i, 0, n)
| ^~~~
vision.cpp:52:2: note: in expansion of macro 'rep'
52 | rep(i, indb.size() - K) {
| ^~~
# | 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... |