# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121855 | huseynahmadli2010 | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 1 ms | 336 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"
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
add_element("00000001");
add_element("00000011");
add_element("00000111");
add_element("00001111");
add_element("00011111");
add_element("00111111");
add_element("01111111");
compile_set();
vector<int> res={0,1,2,3,4,5,6,7};
bool ans1=check_element("00000001");
bool ans2=check_element("00000011");
bool ans3=check_element("00000111");
bool ans4=check_element("00001111");
bool ans5=check_element("00011111");
bool ans6=check_element("00111111");
bool ans7=check_element("01111111");
if(ans1)
{
if(ans2)
{
if(ans3)
{
if(ans4)
{
if(ans5)
{
if(ans6)
{
if(ans7)
return res;
else
{
string s="01111111";
for(int i=1;i<8;i++)
{
swap(s[i],s[0]);
if(check_element(s))
{
swap(res[i],res[0]);
return res;
}
swap(s[i],s[0]);
}
}
}
else
{
string s="00111111";
for(int j=0;j<2;j++)
{
for(int i=2;i<8;i++)
{
swap(s[i],s[j]);
if(check_element(s))
{
swap(res[i],res[j]);
return res;
}
swap(s[i],s[j]);
}
}
}
}
else
{
string s="00011111";
for(int j=0;j<3;j++)
{
for(int i=3;i<8;i++)
{
swap(s[i],s[j]);
if(check_element(s))
{
swap(res[i],res[j]);
return res;
}
swap(s[i],s[j]);
}
}
}
}
else
{
string s="00001111";
for(int j=0;j<4;j++)
{
for(int i=4;i<8;i++)
{
swap(s[i],s[j]);
if(check_element(s))
{
swap(res[i],res[j]);
return res;
}
swap(s[i],s[j]);
}
}
}
}
else
{
string s="00000111";
for(int j=0;j<5;j++)
{
for(int i=5;i<8;i++)
{
swap(s[i],s[j]);
if(check_element(s))
{
swap(res[i],res[j]);
return res;
}
swap(s[i],s[j]);
}
}
}
}
else
{
string s="000000011";
for(int j=0;j<6;j++)
{
for(int i=6;i<8;i++)
{
swap(s[i],s[j]);
if(check_element(s))
{
swap(res[i],res[j]);
return res;
}
swap(s[i],s[j]);
}
}
}
}
else
{
string s="000000001";
for(int j=0;j<7;j++)
{
for(int i=7;i<8;i++)
{
swap(s[i],s[j]);
if(check_element(s))
{
swap(res[i],res[j]);
return res;
}
swap(s[i],s[j]);
}
}
}
return res;
}
# | 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... |