Submission #635118

#TimeUsernameProblemLanguageResultExecution timeMemory
635118JeanBombeurUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
2 ms472 KiB
#include "messy.h" #include <vector> using namespace std; // <|°_°|> // JeanBombeur & M. Broccoli // The hardest choices require the strongest wills // What is better - to be born good, or to overcome your evil nature with great effort ? vector <int> restore_permutation(int nbBits, int nbWrites, int nbReads) { vector <int> Ans(nbBits, 0); string word(nbBits, '0'); for (int bit = 1; bit < nbBits; bit <<= 1) { for (int i = 0; i < nbBits; i ++) { if (i & bit) { word[i] ^= '0' ^ '1'; add_element(word); word[i] ^= '0' ^ '1'; } } for (int i = 0; i < nbBits; i ++) { if (i & bit) word[i] ^= '0' ^ '1'; } } compile_set(); word = string(nbBits, '0'); for (int bit = 1; bit < nbBits; bit <<= 1) { for (int i = 0; i < nbBits; i ++) { word[i] ^= '0' ^ '1'; if (check_element(word)) Ans[i] ^= bit; word[i] ^= '0' ^ '1'; } for (int i = 0; i < nbBits; i ++) { if (Ans[i] & bit) word[i] ^= '0' ^ '1'; } } return Ans; }
#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...