#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
using lli=long long;
#define deb(x) cout<<#x<<": "<<x<<endl;
vector<int> construct_permutation(long long k)
{
int cont=0;
lli pow2=2;
while(pow2*2<= k){
pow2*=2;
cont++;
}
k-=pow2;
vector<int> ans;
int cont2=cont+1;
while(cont>=0){
if(pow2<=k){
ans.pb(cont2);
cont2++;
k-=pow2;
}
ans.pb(cont);
cont--;
pow2/=2;
}
if(k==1){
ans.pb(cont2);
}
reverse(ans.begin(), ans.end());
// deb(k);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
348 KB |
Partially correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Partially correct |
1 ms |
348 KB |
Partially correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Partially correct |
1 ms |
348 KB |
Partially correct |
11 |
Partially correct |
1 ms |
348 KB |
Partially correct |
12 |
Partially correct |
1 ms |
348 KB |
Partially correct |
13 |
Partially correct |
1 ms |
348 KB |
Partially correct |