제출 #44957

#제출 시각아이디문제언어결과실행 시간메모리
44957RayaBurong25_1Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
4 ms640 KiB
#include <vector> #include <iostream> #include "messy.h" std::vector<int> restore_permutation(int n, int w, int r) { std::string S; int i, j, k, lgN; for (lgN = 0; (1 << lgN) < n; lgN++); // std::cout << lgN << "\n"; for (i = 0; i < n; i++) S.push_back('0'); for (i = lgN - 1; i >= 0; i--) { // std::cout << "i = " << i << "\n"; for (j = 0; j < n; j++) { if (j&(1 << i)) { for (k = 0; k < n; k++) { if ((k^j) < (1 << (i + 1))) S[k] = '0'; else S[k] = '1'; } S[j] = '1'; // std::cout << S << "\n"; add_element(S); } } } // std::cout << "Compile Set\n"; compile_set(); std::vector<int> V, Vnew; std::vector<int> Ans; for (i = 0; i < n; i++) { V.push_back(0); S[i] = '0'; } for (i = lgN - 1; i >= 0; i--) { Vnew = V; for (j = 0; j < n; j++) { for (k = 0; k < n; k++) { if (V[k] == V[j]) S[k] = '0'; else S[k] = '1'; } S[j] = '1'; // std::cout << S << "\n"; if (check_element(S)) { Vnew[j] += (1 << i); } } V = Vnew; } return V; }
#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...