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 <vector>
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
string toBin(int num)
{
string res;
while (num > 0)
{
res += (num %= 2) - '0';
res /= 2;
}
return res;
}*/
std::vector<int> restore_permutation(int n, int w, int r) {
for (int i = 1; i < n; i++)
{
string cur;
for (int j = 0; j < i; j++) cur += '1';
for (int j = i; j < n; j++) cur += '0';
add_element(cur);
}
compile_set();
vector<int> perm(n, n - 1);
string cur (n, '0');
for (int i = 1; i < n; i++)
{
vector<int> on;
for (int j = 0; j < n; j++) if (cur[j] == '0') on.push_back(j);
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle (on.begin(), on.end(), std::default_random_engine(seed));
for (int j : on)
{
cur[j] = '1';
if (check_element(cur))
{
//cout << j<< " " << cur << endl;
perm[j] = i - 1;
break;
}
cur[j] = '0';
}
}
return perm;
}
# | 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... |