// model_solution/sol-zoooma13.cpp
#include <bits/stdc++.h>
#include "machine.h"
using namespace std;
vector <int> find_permutation(int n){
vector <int> q(n) ,iq(n+5);
iota(q.begin() ,q.end() ,0);
iota(iq.begin() ,iq.end() ,0);
int w = 1;
while(w+w <= n)
w = w+w;
if(w+w <= n+2){
q[n-1] = w+w;
iq[w+w] = n-1;
}
else{
q[w-1] = n;
iq[n] = w-1;
}
auto r = use_machine(q);
for(int b = 0; b < 30; b++){
int t = 0;
for(int&i : r)
t += i>>b&1;
if(t+t < n)
continue;
for(int&i : r)
i ^= 1<<b;
}
vector <int> p;
for(int&i : r)
p.push_back(iq[i]);
return p;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
5 ms |
444 KB |
Output is correct |
5 |
Correct |
4 ms |
452 KB |
Output is correct |
6 |
Correct |
7 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
344 KB |
Output is correct |
5 |
Correct |
4 ms |
456 KB |
Output is correct |
6 |
Correct |
5 ms |
440 KB |
Output is correct |
7 |
Correct |
5 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
600 KB |
Output is correct |
5 |
Correct |
7 ms |
452 KB |
Output is correct |
6 |
Correct |
6 ms |
440 KB |
Output is correct |
7 |
Correct |
8 ms |
440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
352 KB |
Output is correct |
3 |
Correct |
2 ms |
356 KB |
Output is correct |
4 |
Correct |
5 ms |
356 KB |
Output is correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
344 KB |
Output is correct |
7 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
436 KB |
Output is correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
440 KB |
Output is correct |
7 |
Correct |
5 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
692 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
448 KB |
Output is correct |
5 |
Correct |
4 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
444 KB |
Output is correct |
7 |
Correct |
5 ms |
344 KB |
Output is correct |