# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59008 | tugushka | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 3 ms | 384 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>
using namespace std;
vector < int > res, v;
std::vector<int> restore_permutation(int n, int w, int r) {
for(int i = 1 ; i < n ; i++){
string now = "";
for(int j = 0 ; j < i ; j++) now += '0';
for(int j = 0 ; j < n-i ; j++) now += '1';
add_element(now);
}
compile_set();
string init;
for(int i = 0 ; i < n ; i++) init += '1';
for(int i = 1 ; i < n ; i++){
string now = init;
for(int j = 0 ; j < res.size() ; j++) now[ res[j] ] = '0';
for(int j = 0 ; j < n ; j++){
if( now[j] == '1' ){
string tmp = now;
tmp[j] = '0';
if( check_element( tmp ) ){
// cout << "found : " << i-1 << ' ' << j << endl;
res.push_back( j );
break;
}
}
}
}
for(int i = 0 ; i < n ; i++){
bool f = 1;
for(int j = 0 ; j < res.size() ; j++)
if( i == res[j] ) f = 0;
if( f ){
res.push_back(i);
break;
}
}
v.resize(n);
for(int i = 0 ; i < n ; i++){
v[ res[i] ] = i;
}
/*
int last = n*(n-1)/2;
for(int i = 0 ; i < res.size() ; i++) last -= res[i];
res.push_back(last);
*/
return v;
}
/*
32 320 1024
21 26 18 14 15 8 19 7 17 4 5 31 10 1 9 28 27 0 16 11 13 24 2 30 23 6 22 20 25 12 29 3
8 80 64
5 7 1 3 2 4 0 6
*/
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... |