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>
#include <unordered_map>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef int ll;
ll H, W;
unordered_map<ll, vector<ll>> sum, sub;
unordered_map<ll, ll> sum_, sub_;
ll getloc(ll x, ll y) {
return y * W + x;
}
void construct_network(int H_, int W_, int K) {
H = H_;
W = W_;
ll i, j;
ll s = 100000000, e = 0;
for (i = 0; i < H; i++) {
for (j = 0; j < W; j++) {
sum[i + j].push_back(getloc(i, j));
sub[i - j].push_back(getloc(i, j));
e = max(e, i - j);
s = min(s, i - j);
}
}
unordered_map<ll, vector<ll>>::iterator it;
for (it = sum.begin(); it != sum.end(); it++) sum_[it->first] = add_or(it->second);
for (it = sub.begin(); it != sub.end(); it++) sub_[it->first] = add_or(it->second);
vector<ll> res;
for (i = 0; i + K <= W + H - 2; i++) {
vector<ll> v;
v.push_back(sum_[i]);
v.push_back(sum_[i + K]);
res.push_back(add_and(v));
}
for (i = s; i + K <= e; i++) {
vector<ll> v;
v.push_back(sub_[i]);
v.push_back(sub_[i + K]);
res.push_back(add_and(v));
}
add_or(res);
}
# | 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... |