Submission #637653

#TimeUsernameProblemLanguageResultExecution timeMemory
637653ggohUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
2 ms520 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; #define sz(v) ((int)(v).size()) typedef long long lint; vector<int> restore_permutation(int n, int w, int r) { vector<int>ans; for(int i=0;i<n;i++)ans.push_back(i); string a,b; for(int i=0;i<n;i++)a+='1'; for(int i=n;i>=2;i/=2) { for(int j=0;j<n;j+=i) { b=a; for(int k=0;k<i;k++)b[j+k]='0'; for(int k=0;k<i/2;k++) { b[j+k]='1'; add_element(b); b[j+k]='0'; } } } compile_set(); int l=1; vector<int>V[8][128]; for(int i=0;i<n;i++)V[0][0].push_back(i); for(int i=n;i>=2;i/=2) { for(int j=0;j<n;j+=i) { b=a; for(int k=0;k<i;k++)b[V[l-1][j][k]]='0'; for(int k=0;k<n;k++) { if(b[k]=='1')continue; b[k]='1'; if(check_element(b)) { V[l][j].push_back(k); } else { V[l][j+i/2].push_back(k); } b[k]='0'; } } l++; } for(int i=0;i<n;i++)ans[V[l-1][i][0]]=i; 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...