Submission #591450

#TimeUsernameProblemLanguageResultExecution timeMemory
591450VanillaUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 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(); vector <int> frq(128); if (n == 8) { 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]++; } } } } else if (n == 32) { s = ""; for (int i = 0; i < n; i++) { s.push_back('1'); frq[i] = 1; } vector <int> v; for (int i = 0; i < n; i++){ v.push_back(i); } 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)) { for (int j = 0; j < n; j++){ if (s[j] == '1') frq[j]++; } break; } s[j] = '1'; } } } } vector <int> p (n); for (int i = 0; i < n; i++){ p[i] = frq[i] - 1; } 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...