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;
void construct_network(int n, int m, int k) {
vector<int> OR;
if (k == 1) {
vector<int> row(n), col(m);
for (int i = 0; i < n; ++i) {
vector<int> p;
for (int j = 0; j < m; ++j) p.push_back(i * m + j);
row[i] = add_or(p);
}
for (int j = 0; j < m; ++j) {
vector<int> p;
for (int i = 0; i < n; ++i) p.push_back(i * m + j);
col[j] = add_or(p);
}
int xor_for_rows = add_xor(row), xor_for_cols = add_xor(col);
for (int i = 1; i < n; ++i) OR.push_back(add_and({row[i - 1], row[i], xor_for_cols}));
for (int i = 1; i < m; ++i) OR.push_back(add_and({col[i - 1], col[i], xor_for_rows}));
}
else {
int q = 1e4 - 1;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
vector<int> ask;
for (int h = i; h < n; ++h) for (int w = (i == h ? j : 0); w < m; ++w) if (abs(i - h) + abs(j - w) == k && q > 1) ask.push_back(h * m + w);
if (ask.size()) {
q -= 2;
OR.push_back(add_and({i * m + j, add_xor(ask)}));
}
}
}
}
add_or(OR);
}
# | 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... |