# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1028561 | onbert | Vision Program (IOI19_vision) | C++17 | 21 ms | 3304 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;
int n, m;
int id(int x, int y) {
return x*m + y;
}
void construct_network(int N, int M, int k) {
n = N, m = M;
int nn[2] = {n, m};
int ok[4];
for (int I=0;I<=1;I++) {
int sz = nn[I], kn = min(k, sz-1);
vector<int> OR(sz), XOR(sz), NOTXOR(sz), TWO(sz), range;
for (int i=0;i<sz;i++) {
vector<int> cur;
if (I==0) for (int j=0;j<m;j++) cur.push_back(id(i, j));
else for (int j=0;j<n;j++) cur.push_back(id(j, i));
OR[i] = add_or(cur);
XOR[i] = add_xor(cur);
NOTXOR[i] = add_not(XOR[i]);
TWO[i] = add_and({NOTXOR[i], OR[i]});
}
for (int l=0, r=kn; r<sz; l++, r++) {
// if (I==1) cout << l << " " << r << endl;
vector<int> cur;
for (int j=l;j<=r;j++) cur.push_back({OR[j]});
int x = add_or(cur), y = add_xor(cur), z = add_not(y);
range.push_back(add_and({x, z}));
}
vector<int> ck = TWO;
for (int x:range) ck.push_back(x);
ok[I] = add_or(ck);
}
for (int I=2;I<=3;I++) {
int sz = nn[I];
vector<int> OR;
if (I==2) {
for (int i=-n+1;i<m;i++) {
vector<int> cur;
for (int x=0, y=i; x<n; x++, y++) {
if (x>=0 && x<n && y>=0 && y<m) cur.push_back(id(x, y));
}
if (cur.size()!=0) OR.push_back(add_or(cur));
}
} else if (I==3) {
for (int i=0;i<2*m;i++) {
vector<int> cur;
for (int x=0, y=i; x<n; x++, y--) {
if (x>=0 && x<n && y>=0 && y<m) cur.push_back(id(x, y));
}
if (cur.size()!=0) OR.push_back(add_or(cur));
}
}
vector<int> range;
for (int l=0, r=k; r<OR.size(); l++, r++) {
// cout << l << " " << r << endl;
range.push_back(add_and({OR[l], OR[r]}));
}
ok[I] = add_or(range);
}
int diag = add_or({ok[2], ok[3]});
int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
int ans = add_and({ok[0], ok[1], diag});
}
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... |