Submission #1026710

#TimeUsernameProblemLanguageResultExecution timeMemory
1026710fv3Vision Program (IOI19_vision)C++14
44 / 100
9 ms2264 KiB
/* Vision Program */ #include <bits/stdc++.h> #include "vision.h" using namespace std; int height, width; int arrayPos(int c, int r) { return c * width + r; } bool inside(int c, int r) { return c >= 0 && c < height && r >= 0 && r < width; } void construct_network(int H, int W, int K) { height = H; width = W; vector<int> instructions; for (int c = 0; c < H; c++) { for (int r = 0; r < W; r++) { vector<int> Ns; if (r + K < W) Ns.push_back(arrayPos(c, r + K)); if (c + K < H) Ns.push_back(arrayPos(c + K, r)); for (int j = 1; j < K; j++) { if (inside(c + j, r - (K - j))) Ns.push_back(arrayPos(c + j, r - (K - j))); if (inside(c + j, r + (K - j))) Ns.push_back(arrayPos(c + j, r + (K - j))); } if (Ns.size()) { int i = add_or(Ns); instructions.push_back({add_and({arrayPos(c, r), i})}); } } } add_or(instructions); } /* --Sample testcase-- vector<int> Ns; Ns = {0, 5}; int a = add_and(Ns); Ns = {3, 2}; int b = add_and(Ns); Ns = {a, b}; add_or(Ns); --- 2 3 1 0 0 1 2 -1 */
#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...