이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/extc++.h"
using namespace std;
template <typename T>
void dbgh(const T& t) {
cerr << t << endl;
}
template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
cerr << t << " | ";
dbgh(u...);
}
#ifdef DEBUG
#define dbg(...) \
cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
dbgh(__VA_ARGS__);
#else
#define dbg(...)
#define cerr \
if (false) \
cerr
#endif
#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())
void add_element(string x);
bool check_element(string x);
void compile_set();
vector<int> restore_permutation(int n, int, int) {
mt19937 cowng(chrono::steady_clock::now().time_since_epoch().count());
for (int i = 1; i <= n; i++) {
add_element(string(i, '1') + string(n - i, '0'));
}
compile_set();
string cur(n, '0');
vector<int> ans;
for (int i = 0; i < n; i++) {
vector<int> left;
bool vis[n] {};
for (auto& a : ans) {
vis[a] = true;
}
for (int j = 0; j < n; j++) {
if (!vis[j]) {
left.push_back(j);
}
}
shuffle(begin(left), end(left), cowng);
for (auto& a : left) {
cur[a] = '1';
if (check_element(cur)) {
ans.push_back(a);
break;
}
cur[a] = '0';
}
}
vector<int> tmp(n);
for (int i = 0; i < n; i++) {
tmp[ans[i]] = i;
}
return tmp;
}
# | 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... |