This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "messy.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
vector<int> restore_permutation(int n, int w, int r) {
if(n==8){
map<vector<string>,P>mp;
vector<string>u={
"00001111",
"00110011",
"01010101",
"10001111",
"11001111",
};
rep(i,n)for(int j=i+1;j<n;j++){
vector<string>v=u;
for(auto&s:v)swap(s[i],s[j]);
sort(v.begin(),v.end());
if(mp.count(v))abort();
mp[v]=P(i,j);
}
for(auto&s:u)add_element(s);
compile_set();
vector<string>t;
rep(i,1<<8){
string s;
rep(j,8){
s+=(i>>j&1)+'0';
}
if(check_element(s))t.push_back(s);
}
sort(t.begin(),t.end());
vector<int>ans(n);rep(i,n)ans[i]=i;
P p=mp[t];
swap(ans[p.first],ans[p.second]);
return ans;
}
return {};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |