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 st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<int,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000000000
#define MOD 1000000007
#define N 55
#define MAX 10000006
#define LOG 30
#define KOK 200
using namespace std;
void reorder(string& x,vector<int>& p) {
string res;
for(int i=0;i<sz(p);i++) {
if(~p[i]) res.pb(x[p[i]]);
else res.pb('0');
}
x=res;
}
vector<int> restore_permutation(int n, int w, int r) {
string wadd[128];
string base;
for(int i=0;i<n;i++) base.pb('0');
for(int i=0;i<n;i++) {
wadd[i]=(i==0?base:wadd[i-1]);
wadd[i][i]='1';
add_element(wadd[i]);
//cerr<<wadd[i]<<endl;
}
compile_set();
vector<int> p(n);
for(int i=0;i<n;i++) p[i]=-1;
//cerr<<"compiled\n";
for(int i=0;i<n;i++) {
reorder(wadd[i],p);
//cerr<<wadd[i]<<endl;
for(int j=0;j<n;j++) {
if(wadd[i][j]=='0') {
wadd[i][j]='1';
bool res=check_element(wadd[i]);
wadd[i][j]='0';
if(res) {
p[j]=i;
break ;
}
}
}
}
return p;
}
# | 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... |