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;
#define pb push_back
void construct_network(int n, int m, int k) {
function<int(int, int)> hash = [&](int x, int y) {
return x * m + y;
};
function<bool(int, int)> valid = [&](int x, int y) {
return ((0 <= x && x < n) && (0 <= y && y < m));
};
vector<int> res;
vector<int> fin;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if ((i + j) % (2 * k) < k && (i - j + 1000) % (2 * k) < k) continue;
res.clear();
if (valid(i + k, j)) res.pb(hash(i + k, j));
if (valid(i - k, j)) res.pb(hash(i - k, j));
if (valid(i, j + k)) res.pb(hash(i, j + k));
if (valid(i, j - k)) res.pb(hash(i, j - k));
for (int l = 1; l < k; l++) {
if (valid(i + l, j + (k - l))) res.pb(hash(i + l, j + (k - l)));
if (valid(i + l, j - (k - l))) res.pb(hash(i + l, j - (k - l)));
if (valid(i - l, j + (k - l))) res.pb(hash(i - l, j + (k - l)));
if (valid(i - l, j - (k - l))) res.pb(hash(i - l, j - (k - l)));
}
if (!res.empty()) fin.pb(add_and({hash(i, j), add_or(res)}));
}
}
add_or(fin);
}
# | 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... |