Submission #1004956

#TimeUsernameProblemLanguageResultExecution timeMemory
1004956Mr_HusanboyUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms440 KiB
#include <vector> #include<bits/stdc++.h> using namespace std; #include "messy.h" #define all(a) (a).begin(), (a).end() mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); auto shuffle(vector<int>&a){ int n = a.size(); random_shuffle(all(a)); for(int i = 0; i < n; i ++){ int ii = rng() % n, jj = rng() % n; while(ii == jj) jj = rng() % n; swap(a[ii], a[jj]); } } vector<int> restore_permutation(int n, int w, int r) { for(int i = 0; i < n; i ++){ string s(n, '1'); for(int j = 0; j <= i; j ++) s[j] = '0'; add_element(s); } compile_set(); vector<int> p(n, -1); for(int j = 0; j < n; j ++){ string s(n, '1'); vector<int> done(n); for(int i = 0; i < n; i ++){ if(~p[i]) s[i] = '0', done[i] = 1; } vector<int> perm(n); iota(all(perm), 0); shuffle(perm); for(int i : perm){ if(done[i]) continue; s[i] = '0'; if(check_element(s)){ //cout << i << ' ' << j << endl; p[i] = j; break; } s[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...