# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422819 | 2021-06-10T12:46:35 Z | SSRS | Vision Program (IOI19_vision) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "vision.h" using namespace std; void construct_network(int H, int W, int K){ assert(K == 1); int mx = H + W - 1; vector<vector<int>> id1(mx), id2(mx); for (int i = 0; i < H; i++){ for (int j = 0; j < W; j++){ id1[i + j].push_back(i * W + j); id2[i - j + (W - 1)].push_back(i * W + j); } } vector<int> a(mx), b(mx); for (int i = 0; i < mx; i++){ a[i] = add_or(id1[i]); b[i] = add_or(id2[i]); } vector<int> a2(mx - 1), b2(mx - 1); for (int i = 0; i < mx - 1; i++){ a2[i] = add_and({a[i], a[i + 1]}); b2[i] = add_and({b[i], b[i + 1]}); } int X = add_or(a2); int Y = add_or(b2); add_and(X, Y); }