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; using ii = pair<int,int>; using ll = long long; using vi = vector<int>;
#define rep(i,a,b) for (auto i = (a); i <= (b); ++i)
#define per(i,a,b) for (auto i = (b); i >= (a); --i)
#define all(x) begin(x), end(x)
#define siz(x) int((x).size())
#define Mup(x,y) x = max(x,y)
#define mup(x,y) x = min(x,y)
#define fi first
#define se second
#define dbg(...) fprintf(stderr,__VA_ARGS__)
inline vi flip(vi v, int k) { v[k] ^= 1; return v; }
inline string str(vi v) {
string r;
for (const auto &e : v) r += '0'+e;
return r;
}
vi restore_permutation(int n, int w, int r) {
rep(i,1,n) add_element(string(i,'1')+string(n-i,'0'));
compile_set();
vi p(n), b(n), ch(n);
rep(i,0,n-1) {
rep(j,0,n-1) if (!ch[j]) {
if (check_element(str(flip(b,j)))) {
ch[j] = 1;
p[j] = i;
b[j] = 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... |