제출 #301625

#제출 시각아이디문제언어결과실행 시간메모리
301625QCFiumVision Program (IOI19_vision)C++14
100 / 100
20 ms2172 KiB
#include "vision.h" #include <bits/stdc++.h> void construct_network(int h, int w, int k) { add_not(0); std::vector<std::vector<int> > r0(h + w - 1); std::vector<std::vector<int> > r1(h + w - 1); for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) { r0[i + j].push_back(w * i + j); r1[i - j + (w - 1)].push_back(w * i + j); } int base_raw0 = h * w + 1; for (auto &i : r0) add_or(i); int base_raw1 = base_raw0 + (h + w - 1); for (auto &i : r1) add_or(i); int forward0 = base_raw1 + (h + w - 1); add_and({0, h * w}); for (int i = 0; i < h + w - 1; i++) add_or({forward0 + i, base_raw0 + i}); int back0 = forward0 + h + w; add_and({0, h * w}); for (int i = 0; i < h + w - 1; i++) add_or({back0 + i, base_raw0 + (h + w - 2) - i}); int forward1 = back0 + h + w; add_and({0, h * w}); for (int i = 0; i < h + w - 1; i++) add_or({forward1 + i, base_raw1 + i}); int back1 = forward1 + h + w; add_and({0, h * w}); for (int i = 0; i < h + w - 1; i++) add_or({back1 + i, base_raw1 + (h + w - 2) - i}); int prev = back1 + h + w; add_and({0, h * w}); int band = h + w - k - 1; for (int i = 0; i <= band; i++) { add_and({forward0 + i, back0 + (band - i)}); add_or({prev, prev + 1}); add_and({forward1 + i, back1 + (band - i)}); add_or({prev + 2, prev + 3}); prev += 4; } // if (prev) -> return false add_and({0, h * w}); int oring = prev + 1; for (int i = 0; i + k < h + w - 1; i++) { add_and({base_raw0 + i, base_raw0 + i + k}); add_or({oring, oring + 1}); add_and({base_raw1 + i, base_raw1 + i + k}); add_or({oring + 2, oring + 3}); oring += 4; } // oring && !prev add_not(prev); add_and({oring, oring + 1}); } /* int main() { return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...