이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |