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__)
vi restore_permutation(int n, int w, int r) {
assert(n==8);
rep(i,1,8) {
add_element(string(n-i,'0')+string(i,'1'));
}
compile_set();
vi p(n); iota(all(p),0);
vi idx;
int a=-1, b=-1;
rep(i,0,7) {
if (check_element(string(i,'0')+string(n-i,'1'))) {
a = i;
} else break;
}
rep(i,a+1,7) {
if (!check_element(string(i,'0')+string(n-i,'1'))) {
b = i;
} else break;
}
if (a != -1 and b != -1) swap(p[a],p[b]);
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... |