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;
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= b; --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)
#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
const int INF = (int)(1e9);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
int nbElem, nbAdd, nbCheck;
vector<int> st123()
{
vector<int> px(nbElem);
form(i, nbElem) px[i] = i;
random_shuffle(px.begin(), px.end());
vector<int> perm(nbElem);
string s;
form(i, nbElem) s.push_back('0');
string curVu = s;
form(i, nbElem) {
s[i] = '1';
add_element(s);
}
compile_set();
form(cherche, nbElem) {
s = curVu;
form(rt, nbElem) {
int teste = px[rt];
if (curVu[teste] == '1') continue;
s[teste] = '1';
if (check_element(s)) { perm[teste] = cherche; curVu[teste] = '1'; break; }
s[teste] = '0';
}
}
return perm;
}
vector<int> restore_permutation(int n, int w, int r) {
nbElem = n;
nbAdd = w;
nbCheck = r;
vector<int> p(n);
form(i, n) p[i] = i;
if (n <= 32) {
return st123();
}
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... |