# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
281588 | 2020-08-23T08:51:24 Z | NONAME | Vision Program (IOI19_vision) | C++14 | 0 ms | 0 KB |
#include "vision.h" void construct_network(int H, int W, int K) { std::vector <int> res, res1; if ((H > 30) || (W > 30)) { for (int x = 0; x < H; ++x) for (int y = 0; y < W; ++y) { if (x + y != K) continue; cur.push_back(x * W + y); } add_or(cur); add_and({0, H * W}); } else { int cnt = 0; for (int x1 = 0; x1 < H; ++x1) for (int y1 = 0; y1 < W; ++y1) { std::vector <int> cur; for (int x2 = 0; x2 < H; ++x2) for (int y2 = 0; y2 < W; ++y2) { if ((abs(x1 - x2) + abs(y1 - y2)) != K) continue; cur.push_back(x2 * W + y2); } if (cur.empty()) continue; add_or(cur); res.push_back(H * W + cnt); ++cnt; add_and({x1 * W + y1, res.back()}); res1.push_back(H * W + cnt); ++cnt; } add_or(res1); } }