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 <iostream>
#include <algorithm>
#include <random>
#include <vector>
#include <iterator>
#include "messy.h"
using namespace std;
std::random_device rd;
std::mt19937 g(rd());
vector<int> restore_permutation(int n, int w, int r) {
for (int i = 1 ; i <= n ; ++ i) {
string cur = "";
for (int _ = 0 ; _ < i ; ++ _) cur += "1";
for (int _ = 0 ; _ < n - i ; ++ _) cur += "0";
add_element(cur);
}
compile_set();
vector<int>p(n, -1);
vector<int>R(n);
for (int i = 0 ; i < n ; ++ i) R.emplace_back(i);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
shuffle(R.begin(), R.end(), g);
for (int i = 1 ; i <= n ; ++ i) {
string cur(n, '0');
for (int j = 0 ; j < n ; ++ j) if (p[j] != -1) cur[j] = '1';
for (int j : R) if (cur[j] == '0') {
string temp = cur;
temp[j] = '1';
if (check_element(temp)) {
p[j] = i - 1;
break;
}
}
}
return p;
}
# | 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... |