Submission #591334

#TimeUsernameProblemLanguageResultExecution timeMemory
591334VanillaUnscrambling 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) { vector <int> p; for (int i = 0; i < 8; i++){ p.push_back(i); } string s = ""; for (int i = 0; i < 8; i++){ s.push_back('1'); } for (int i = 0; i < 8; i++){ add_element(s); s[i] = '0'; } compile_set(); vector <int> frq(10); 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]++; } } } for (int i = 0; i < 8; i++){ if (frq[i] != i + 1) { swap(p[i], p[frq[i] - 1]); break; } } // for (auto i: p){ // cout << i << " "; // } // cout << "\n"; 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...