Submission #395079

#TimeUsernameProblemLanguageResultExecution timeMemory
395079idk321Unscrambling a Messy Bug (IOI16_messy)C++11
38 / 100
1 ms332 KiB
#include <vector> #include "messy.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; /* string toBin(int num) { string res; while (num > 0) { res += (num %= 2) - '0'; res /= 2; } return res; }*/ std::vector<int> restore_permutation(int n, int w, int r) { for (int i = 1; i <= n; i++) { string cur; for (int j = 0; j < i; j++) cur += '1'; for (int j = i; j < n; j++) cur += '0'; add_element(cur); } compile_set(); vector<int> perm(n); string cur (n, '0'); for (int i = 1; i <= n; i++) { vector<int> on; for (int j = 0; j < n; j++) if (cur[j] == '0') on.push_back(j); unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); shuffle (on.begin(), on.end(), std::default_random_engine(seed)); for (int j : on) { cur[j] = '1'; if (check_element(cur)) { //cout << j<< " " << cur << endl; perm[j] = i - 1; break; } cur[j] = '0'; } } return perm; }
#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...