Submission #229824

#TimeUsernameProblemLanguageResultExecution timeMemory
229824achibasadzishviliUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
5 ms384 KiB
#include <bits/stdc++.h> #define ll int #define f first #define s second #define pb push_back using namespace std; #include "messy.h" vector<int> restore_permutation(int n, int w, int r){ srand(time(NULL)); string s = ""; for(int i=1; i<=n; i++) s += '0'; for(int i=0; i<n; i++){ s[i] = '1'; add_element(s); } compile_set(); string a = ""; for(int i=0; i<n; i++) a += '0'; vector<ll>p; for(int i=0; i<n; i++) p.pb(0); for(int i=0; i<n; i++){ vector<ll>k; for(int j=0; j<n; j++) if(a[j] == '0') k.pb(j); random_shuffle(k.begin() , k.end()); for(int ji=0; ji<n; ji++){ int j = k[ji]; if(a[j] == '0'){ a[j] = '1'; if(check_element(a)){ //cout << i << " <-> " << j << '\n'; p[j] = i; break; } a[j] = '0'; } } } 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...