Submission #591445

#TimeUsernameProblemLanguageResultExecution timeMemory
591445VanillaUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "messy.h" #include <vector> using namespace std; vector<int> restore_permutation(int n, int w, int r) { string s = ""; for (int i = 0; i < n; i++){ s.push_back('1'); } for (int i = 0; i < n; i++){ add_element(s); s[i] = '0'; } compile_set(); if (n == 8) { vector <int> frq (128); for (int i = 0; i < 256; i++){ string s = ""; for (int j = 0; j < 8; j++){ s = char('0' + !!(i & (1 << j))) + s; } if(check_element(s)) { for (int j = 0; j < 8; j++){ if (s[j] == '1') frq[j]++; } } } vector <int> p (n); for (int i = 0; i < n; i++){ p[i] = frq[i] - 1; } return p; } else if (n == 32) { s = ""; for (int j = 0; j < n; j++) s.push_back('1'); vector <int> p (32); vector <int> v; for (int j = 0; j < n; j++) v.push_back(j); for (int i = 0; i < n; i++){ shuffle(v.begin(), v.end(), std::default_random_engine(chrono::system_clock::now().time_since_epoch().count())); for (int j: v){ if (s[j] == '1') { s[j] = '0'; if (check_element(s)) { p[j] = i; break; } s[j] = '1'; } } } return p; } return vector <int> (); }
#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...