Submission #1050345

#TimeUsernameProblemLanguageResultExecution timeMemory
1050345HalitVision Program (IOI19_vision)C++17
44 / 100
9 ms2652 KiB
#include "vision.h" #include <bits/stdc++.h> void construct_network(int H, int W, int K) { if (H == 1 || W == 1) { std::vector<int> idx; for (int i = 0;i + K < H*W; ++i) { idx.push_back(add_and({i, i+K})); } add_or(idx); return; } if (H * W <= 900) { std::vector<int> imp; for (int i = 0;i < H*W; ++i) { std::vector<int> idx; for (int j = i+1;j < H*W; ++j) { int x1 = i / W; int y1 = i % W; int x2 = j / W; int y2 = j % W; if (std::abs(x1 - x2) + std::abs(y1 - y2) == K) { idx.push_back(j); } } if (idx.size()) { imp.push_back(add_and(std::vector<int>{i, (add_or(idx))})); } } add_or(imp); return; } if (K == 1) { std::vector<std::vector<int>> a(H+W), b(H+W); for (int i = 0;i < H; ++i) { for (int j = 0;j < W; ++j) { a[i + j].push_back(i * W + j); b[H - i + W - j - 2].push_back(i * W + j); } } std::vector<int> idx1, idx2; for (int i = 0;i+1 < H+W-1; ++i) { std::vector<int> cur1, cur2; cur1.push_back(add_or(a[i])); cur1.push_back(add_or(a[i+1])); cur2.push_back(add_or(b[i])); cur2.push_back(add_or(b[i+1])); idx1.push_back(add_and(cur1)); idx2.push_back(add_and(cur2)); } std::vector<int> imp; imp.push_back(add_or(idx1)); imp.push_back(add_or(idx2)); add_and(imp); return; } }
#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...