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<bits/stdc++.h>
#include "messy.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
vector<int> restore_permutation(int n, int w, int r){
if(n==8){
vector<int>p(n);
string s(n,'0');
for(int i=n-1;i>=0;i--){
add_element(s);
s[i]='1';
}
compile_set();
vector<int>cnt(n,0);
for(int i=0;i<(1<<n);i++){
string t="";
for(int j=0;j<n;j++){
if(i&(1<<j)) t+='0';
else t+='1';
}
if(check_element(t)){
for(int j=0;j<n;j++){
if(~i&(1<<j)){
cnt[j]++;
}
}
}
}
for(int i=0;i<n;i++){
p[i]=cnt[i];
}
return p;
}
if(n==32){
vector<int>ord(n);
iota(all(ord),0);
random_shuffle(all(ord));
vector<int>p(n);
string s(n,'0');
for(int i=0;i<n;i++){
s[i]='1';
add_element(s);
}
compile_set();
string cur(n,'0');
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(cur[ord[j]]=='0'){
cur[ord[j]]='1';
if(check_element(cur)){
p[ord[j]]=i;
break;
}
else{
cur[ord[j]]='0';
}
}
}
}
return p;
}
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... |