# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1027860 | 0npata | Vision Program (IOI19_vision) | C++17 | 1044 ms | 2980 KiB |
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 vec vector
void construct_network(int H, int W, int K) {
//cerr << H << ' ' << W << ' ' << K << '\n';
auto dist = [&](int i, int j) {
int x1 = i%W;
int y1 = i/W;
int x2 = j%W;
int y2 = j/W;
return abs(x1-x2)+abs(y1-y2);
};
vec<int> cand(0);
vec<pair<int, int>> extra(0);
for(int i = 0; i<H*W; i++) {
vec<int> xor_check(0);
for(int j = i+1; j<H*W; j++) {
if(dist(i, j) == K) {
xor_check.push_back(j);
// cerr << "HERE" << '\n';
}
}
if(xor_check.size() > 1) {
add_xor(xor_check);
cand.push_back(i);
}
else if(xor_check.size() == 1) {
extra.push_back({i, xor_check[0]});
}
}
for(int i = 0; i<cand.size(); i++) {
add_and({cand[i], i+H*W});
}
for(auto [x, y] : extra) {
add_and({x, y});
}
// cerr << "OK" << '\n';
vec<int> or_check(cand.size()+extra.size());
// cerr << cnt << '\n';
iota(or_check.begin(), or_check.end(), H*W+cand.size());
add_or(or_check);
}
Compilation message (stderr)
# | 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... |