Submission #442156

#TimeUsernameProblemLanguageResultExecution timeMemory
442156peijarVision Program (IOI19_vision)C++17
46 / 100
39 ms3552 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; /* * Subtask 1 - 2 - 5 - 6 : AC : 41 * Subtask 7 : Need smart way of doing it * Subtask 3 4 6 8 */ void construct_network(int nbLig, int nbCol, int K) { int maxDeltaLig = min(nbLig - 1, K); vector<int> avecDeltaLig(maxDeltaLig + 1); for (int deltaLig = 1; deltaLig <= maxDeltaLig; ++deltaLig) { vector<int> aDemander; for (int lig = 0; lig + deltaLig < nbLig; ++lig) { vector<int> cases1, cases2; for (int col = 0; col < nbCol; ++col) { int pos1 = col + nbCol * lig; int pos2 = col + nbCol * (lig + deltaLig); cases1.push_back(pos1); cases2.push_back(pos2); } int l1 = add_or(cases1), l2 = add_or(cases2); int x = add_and({l1, l2}); aDemander.push_back(x); } avecDeltaLig[deltaLig] = add_or(aDemander); } // 2 sur meme lig ? vector<int> sameLig; for (int lig = 0; lig < nbLig; ++lig) { vector<int> pos; for (int col = 0; col < nbCol; ++col) pos.push_back(col + nbCol * lig); sameLig.push_back(add_and({add_or(pos), add_not(add_xor(pos))})); } avecDeltaLig[0] = add_or(sameLig); int maxDeltaCol = min(nbCol - 1, K); vector<int> avecDeltaCol(maxDeltaCol + 1); for (int deltaCol = 1; deltaCol <= maxDeltaCol; ++deltaCol) { vector<int> aDemander; for (int col = 0; col + deltaCol < nbCol; ++col) { vector<int> cases1, cases2; for (int lig = 0; lig < nbLig; ++lig) { int pos1 = col + nbCol * lig; int pos2 = col + deltaCol + nbCol * lig; cases1.push_back(pos1); cases2.push_back(pos2); } int l1 = add_or(cases1), l2 = add_or(cases2); int x = add_and({l1, l2}); aDemander.push_back(x); } avecDeltaCol[deltaCol] = add_or(aDemander); } vector<int> sameCol; for (int col = 0; col < nbCol; ++col) { vector<int> pos; for (int lig = 0; lig < nbLig; ++lig) pos.push_back(col + nbCol * lig); sameCol.push_back(add_and({add_or(pos), add_not(add_xor(pos))})); } avecDeltaCol[0] = add_or(sameCol); vector<int> q; for (int dL = 0; dL <= maxDeltaLig; ++dL) { int dC = K - dL; if (dC >= 0 and dC <= maxDeltaCol) q.push_back(add_and({avecDeltaCol[dC], avecDeltaLig[dL]})); } add_or(q); /*std::vector<int> Ns; Ns = {0, 1}; int a = add_and(Ns); Ns = {0, a}; int b = add_or(Ns); Ns = {0, 1, b}; int c = add_xor(Ns); add_not(c);*/ }
#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...