# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
414982 | Ahmadsm2005 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 3 ms | 348 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 <bits/stdc++.h>
#include "messy.h"
//#include "grader.cpp"
using namespace std;
int P[150];
vector<int>restore_permutation(int n,int w,int r){
srand(2005);
string s;
vector<int>ANS;
for(int i=0;i<n;i++)
s+='0';
for(int i=0;i<n;i++){
s[i]='1';
add_element(s);
}
compile_set();
for(int i=0;i<n;i++)
s[i]='0';
int FF=0;
while(1){
int X=count(s.begin(),s.end(),'0');
if(!X)
break;
while(1){
int Q=rand()%X,POS;
for(int i=0;i<n;i++){
if(s[i]=='0'&&!Q){
s[i]='1',POS=i;
break;
}
else if(s[i]=='0')
Q--;
}
string t;
for(int i=0;i<n;i++)
if(s[i]=='X')
t+='0';
else
t+=s[i];
if(X>1){
if(check_element(t)){
s=t;
P[POS]=FF;
break;
}
else
s[POS]='X';
}
else{
s=t;
P[POS]=FF;
break;
}
X--;
}
FF++;
}
for(int i=0;i<n;i++)
ANS.push_back(P[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... |