제출 #601261

#제출 시각아이디문제언어결과실행 시간메모리
601261SeDunionUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms340 KiB
#include <iostream> #include <algorithm> #include <random> #include <vector> #include <iterator> #include "messy.h" using namespace std; std::random_device rd; std::mt19937 g(rd()); vector<int> restore_permutation(int n, int w, int r) { for (int i = 1 ; i <= n ; ++ i) { string cur = ""; for (int _ = 0 ; _ < i ; ++ _) cur += "1"; for (int _ = 0 ; _ < n - i ; ++ _) cur += "0"; add_element(cur); } compile_set(); vector<int>p(n, -1); vector<int>R(n); for (int i = 0 ; i < n ; ++ i) R.emplace_back(i); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); shuffle(R.begin(), R.end(), g); for (int i = 1 ; i <= n ; ++ i) { string cur(n, '0'); for (int j = 0 ; j < n ; ++ j) if (p[j] != -1) cur[j] = '1'; for (int j : R) if (cur[j] == '0') { string temp = cur; temp[j] = '1'; if (check_element(temp)) { p[j] = i - 1; break; } } } return p; }
#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...