Submission #1026702

#TimeUsernameProblemLanguageResultExecution timeMemory
1026702fv3Vision Program (IOI19_vision)C++14
33 / 100
3 ms1240 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++) { if (r + K < W) instructions.push_back(add_and({arrayPos(c, r), arrayPos(c, r + K)})); if (c + K < H) instructions.push_back(add_and({arrayPos(c, r), arrayPos(c + K, r)})); for (int j = 1; j < K; j++) { if (inside(c + j, r - (K - j))) instructions.push_back(add_and({arrayPos(c, r), arrayPos(c + j, r - (K - j))})); if (inside(c + j, r + (K - j))) instructions.push_back(add_and({arrayPos(c, r), arrayPos(c + j, r + (K - j))})); } } } 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...