#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) {
vi mp(n); iota(all(mp),0);
random_shuffle(all(mp));
for (auto j : mp) 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 |
1 |
Correct |
0 ms |
348 KB |
n = 8 |
2 |
Correct |
0 ms |
348 KB |
n = 8 |
3 |
Correct |
0 ms |
348 KB |
n = 8 |
4 |
Correct |
0 ms |
348 KB |
n = 8 |
5 |
Correct |
0 ms |
348 KB |
n = 8 |
6 |
Correct |
0 ms |
348 KB |
n = 8 |
7 |
Correct |
0 ms |
348 KB |
n = 8 |
8 |
Correct |
0 ms |
348 KB |
n = 8 |
9 |
Correct |
0 ms |
348 KB |
n = 8 |
10 |
Correct |
0 ms |
348 KB |
n = 8 |
11 |
Correct |
0 ms |
348 KB |
n = 8 |
12 |
Correct |
0 ms |
344 KB |
n = 8 |
13 |
Correct |
0 ms |
348 KB |
n = 8 |
14 |
Correct |
0 ms |
348 KB |
n = 8 |
15 |
Correct |
0 ms |
348 KB |
n = 8 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
n = 32 |
2 |
Correct |
0 ms |
348 KB |
n = 32 |
3 |
Correct |
1 ms |
348 KB |
n = 32 |
4 |
Correct |
1 ms |
348 KB |
n = 32 |
5 |
Correct |
1 ms |
348 KB |
n = 32 |
6 |
Correct |
0 ms |
348 KB |
n = 32 |
7 |
Correct |
0 ms |
348 KB |
n = 32 |
8 |
Correct |
0 ms |
348 KB |
n = 32 |
9 |
Correct |
0 ms |
348 KB |
n = 32 |
10 |
Correct |
0 ms |
348 KB |
n = 32 |
11 |
Correct |
0 ms |
344 KB |
n = 32 |
12 |
Correct |
0 ms |
348 KB |
n = 32 |
13 |
Correct |
0 ms |
348 KB |
n = 32 |
14 |
Correct |
0 ms |
348 KB |
n = 32 |
15 |
Correct |
0 ms |
348 KB |
n = 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
n = 32 |
2 |
Correct |
0 ms |
348 KB |
n = 32 |
3 |
Correct |
0 ms |
348 KB |
n = 32 |
4 |
Correct |
0 ms |
348 KB |
n = 32 |
5 |
Incorrect |
0 ms |
348 KB |
grader returned WA |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
grader returned WA |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
grader returned WA |
2 |
Halted |
0 ms |
0 KB |
- |