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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> restore_permutation(int n, int w, int r) {
string str;
for(int i = 0;i<n;i++)str += '0';
for(int i = 0;i<n;i++){
str[i] = '1';
add_element(str);
}
for(int i = 0;i<n;i++)str[i] = '0';
compile_set();
int perm[n] , vis[n] = {0};
for(int i = 0;i<n;i++)perm[i] = i;
shuffle(perm , perm + n , rng);
vector < int > ans(n);
for(int i = 0;i<n;i++){
for(int j = 0;j<n;j++){
if(vis[j])continue;
str[perm[j]] = '1';
if(check_element(str)){
ans[perm[j]] = i;
// cout << "ans : " << perm[j] << " = " << i << endl;
vis[j] = 1;
break;
}
else{
str[perm[j]] = '0';
}
}
}
return ans;
// add_element("0");
// compile_set();
// check_element("0");
// return std::vector<int>();
}
# | 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... |