Submission #624666

#TimeUsernameProblemLanguageResultExecution timeMemory
624666sofapudenUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
3 ms468 KiB
#include<bits/stdc++.h> #include "messy.h" using namespace std; vector<int> restore_permutation(int n, int w, int r) { string emp(n,'0'); for(int i = n>>1; i; i>>=1){ for(int j = 0; j < n; ++j){ if((j/i)&1)continue; string s = emp; s[j] = '1'; for(int k = 0; k < n; ++k){ if(j/i == k/i || ((j/i)^1) == k/i)continue; s[k] = '1'; } add_element(s); } } compile_set(); vector<vector<int>> A[2]; vector<int> v(n); iota(v.begin(),v.end(),0); A[0].push_back(v); int b = __lg(n); for(int i = 0; i < b; ++i){ A[1].clear(); for(int j = 0; j < (1<<i); ++j){ vector<int> F,S; string cu = emp; for(int k = 0; k < (1<<i); ++k){ if(j == k)continue; for(auto x : A[0][k])cu[x] = '1'; } for(auto x : A[0][j]){ string s = cu; s[x] = '1'; if(check_element(s))F.push_back(x); else S.push_back(x); } A[1].push_back(F); A[1].push_back(S); } swap(A[1],A[0]); } vector<int> ret(n); for(int i = 0; i < n; ++i){ ret[A[0][i][0]] = i; } return ret; }
#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...