Submission #591437

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