# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1156722 | Doncho_Bonboncho | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
#include <cstring>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "messy.h"
using namespace std;
#ifndef LOCAL
#define cerr if( false ) cerr
#endif
#define out(x) #x << " = " << x << " "
std::vector<int> restore_permutation(int n, int w, int r) {
for( int i=0 ; i < n ; i++ ){
std::string curr = "";
for( int j=0 ; j < n ; j++ ){
if( j <= i ) curr += "1";
else curr += "0";
}
cerr << out(curr ) << endl;
add_element( curr );
}
compile_set();
std::vector< int > unKnown( n );
std::iota( unKnown.begin(), unKnown.end(), 0 );
std::string base = "";
std::vector< int > nas( n );
for( int i=0 ; i < n ; i++ ) base += "0";
for( int i=0 ; i < n ; i++ ){
for( int j=0 ; j < (int)unKnown.size() ; j++ ){
std::string curr = base;
curr[unKnown[j]] = '1';
cerr << " ? " << out( curr ) << endl;
if( check_element( curr ) ){
nas[i] = unKnown[j];
base = curr;
std::swap( unKnown[j], unKnown.back() );
unKnown.pop_back();
break;
}
}
}
for( auto j : nas ) cerr << j << " ";
cerr << endl;
return nas;
}
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... |