# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59803 | alenam0161 | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 3 ms | 512 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 <vector>
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 4007;
int wh[N];
bool used[N];
std::vector<int> restore_permutation(int n, int w, int r) {
srand(1572921);
string s=string(n,'0');
for(int i=1;i<n;++i){
string s1=string(i,'1');
s1+=string(n-i,'0');
add_element(s1);
}
compile_set();
for(int i=0;i<n-1;++i){
string sx=s;
vector<int> l;
for(int j=0;j<n;++j){
if(used[j]==0){
l.push_back(j);
}
}
random_shuffle(l.begin(),l.end());
for(int j=0;j<l.size();++j){
string nw=s;
nw[l[j]]='1';
if(check_element(nw)==true){
s[l[j]]='1';
wh[l[j]]=i;
used[l[j]]=true;
break;
}
}
}
for(int j=0;j<n;++j){
if(used[j]==0)wh[j]=n-1;
}
vector<int> ans;
for(int i=0;i<n;++i){
ans.push_back(wh[i]);
}
return ans;
}
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... |