#include<bits/stdc++.h>
#include "perm.h"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<ll, P>;
const ll n_ =4e5+100, inf = (ll)2e9 * (ll)1e9 + 7, mod = 998244353;
ll n, m, tc = 1, a, b, c, d, sum, x, y, z, base, ans, k;
ll gcd(ll x,ll y){
if(!y)return x;
return gcd(y,x%y);
}
vector<int> construct_permutation(long long k){
vector<int>res,A;
x=k-1;
while(x){
bool flag=0;
for(int i=59;i>=1;i--){
a=(1ll<<i);
if(x%a)continue;
x=(x-a)/a;
A.push_back(i);
flag=true;
break;
}
if(!flag)A.push_back(0),x=(x-1)/2;
}
reverse(all(A));
for(auto nxt:A){
if(nxt==0)res.push_back(res.size());
else{
ll now=res.size()+1;
for(auto &i:res)i++;
for(int j=0;j<nxt;j++)res.push_back(now+j);
res.push_back(0);
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Partially correct |
2 ms |
348 KB |
Partially correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Partially correct |
2 ms |
344 KB |
Partially correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Partially correct |
3 ms |
348 KB |
Partially correct |
11 |
Partially correct |
2 ms |
344 KB |
Partially correct |
12 |
Partially correct |
2 ms |
348 KB |
Partially correct |
13 |
Partially correct |
2 ms |
348 KB |
Partially correct |