Submission #553332

#TimeUsernameProblemLanguageResultExecution timeMemory
553332ITOVision Program (IOI19_vision)C++17
100 / 100
23 ms2156 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; // rewrite. use clear front to find void construct_network(int h, int w, int k) { int n[2] = {h, w}, t0 = add_xor({0, 0}), t1 = add_not(t0), ov, qw[2][9]; vector<int> hw[2], hwx[2][2], an; for (int i = 0; i < h; i++) { // each row vector<int> tmp; for (int j = 0; j < w; j++) { tmp.push_back(i * w + j); } hw[0].push_back(add_or(tmp)); } for (int j = 0; j < w; j++) { // each col vector<int> tmp; for (int i = 0; i < h; i++) { tmp.push_back(i * w + j); } hw[1].push_back(add_or(tmp)); } for (int ii = 0; ii < 2; ii++) { for (int i = 0; i < n[ii]; i++) { vector<int> tmp0, tmp1; for (int j = 0; j < i; j++) { tmp0.push_back(hw[ii][j]); } for (int j = i + 1; j < n[ii]; j++) { tmp1.push_back(hw[ii][j]); } int te0 = tmp0.empty() ? t1 : add_not(add_or(tmp0)), te1 = tmp1.empty() ? t1 : add_not(add_or(tmp1)); hwx[ii][0].push_back(add_and({hw[ii][i], te0})); hwx[ii][1].push_back(add_and({hw[ii][i], te1})); } ov = t1; for (int i = 0; i < 8; i++) { vector<int> tmp0, tmp1; for (int j = 0; j < n[ii]; j++) { if (j & (1 << i)) { tmp0.push_back(hwx[ii][0][j]); tmp1.push_back(hwx[ii][1][j]); } } int te0 = tmp0.empty() ? t1 : add_not(add_or(tmp0)), te1 = tmp0.empty() ? t0 : add_or(tmp1), suu = add_xor({te0, te1}); qw[ii][i] = add_xor({suu, ov}); ov = add_or({add_and({suu, ov}), add_and({te0, te1})}); } } qw[0][8] = t0, qw[1][8] = t0; ov = t0; for (int i = 0; i < 9; i++) { int bb = (k & (1 << i)) ? t1 : t0, suu = add_xor({qw[0][i], qw[1][i]}); an.push_back(add_xor({bb, suu, ov})); ov = add_or({add_and({suu, ov}), add_and({qw[0][i], qw[1][i]})}); } add_not(add_or(an)); 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...