Submission #543467

#TimeUsernameProblemLanguageResultExecution timeMemory
543467timreizinUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms340 KiB
#include <vector> #include "messy.h" #include <random> using namespace std; vector<int> restore_permutation(int n, int w, int r) { random_device rd; mt19937 gen(rd()); string number(n, '0'); for (int i = 0; i < n; ++i) { number[i] = '1'; add_element(number); } compile_set(); vector<int> p(n, -1); number = string(n, '0'); for (int i = 0; i < n; ++i) { while (true) { uniform_int_distribution dist(1, n - i); int ind = dist(gen); bool flag = false; for (int j = 0; j < n; ++j) { if (number[j] == '0') --ind; if (ind == 0) { number[j] = '1'; if (check_element(number)) { p[j] = i; flag = true; break; } number[j] = '0'; break; } } if (flag) 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...