# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
207074 | autumn_eel | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 5 ms | 376 KiB |
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<=32){
rep(i,n){
string s;
rep(j,n){
if(j<=i)s+='0';
else s+='1';
}
add_element(s);
}
compile_set();
vector<int>v(n),p(n);//p[v[i]]=i
random_device rnd;
rep(i,n){
string s(n,'1');
rep(j,i)s[v[j]]='0';
vector<int>c;
rep(j,n){
if(s[j]=='1')c.push_back(j);
}
shuffle(c.begin(),c.end(),rnd);
rep(k,c.size()){
int j=c[k];
if(s[j]=='0')continue;
s[j]='0';
if(check_element(s)){
v[i]=j;break;
}
s[j]='1';
}
}
rep(i,n){
p[v[i]]=i;
}
return p;
}
return {};
}
Compilation message (stderr)
# | 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... |