# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50339 | faishol27 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 2 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>ans;
string solve(int cnt, string s){
string ret = s;
int len = s.length();
for(int i=0;i<len;i++){
if(ret[i]=='1') continue;
ret[i] = '1';
if(check_element(ret)){
ans[i] = cnt-1;
return ret;
}else{
ret[i] = '0';
}
}
}
void solve_last(int N){
bitset<300>stt;
for(auto elm:ans) if(elm != -1) stt[elm] = 1;
for(int i=0;i<N;i++){
if(ans[i] == -1){
for(int j=0;j<N;j++)
if(stt[j]==0){
ans[i] = j;
break;
}
}
}
}
std::vector<int> restore_permutation(int N, int W, int R) {
ans.resize(N, -1);
string B = "",
tmp = "";
for(int i=0;i<N;i++){
B += "0";
tmp += "0";
}
for(int i=0;i<N-1;i++){
B[i] = '1';
add_element(B);
}
compile_set();
for(int i=1;i<N;i++){
tmp = solve(i, tmp);
}
solve_last(N);
return std::vector<int>(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... |