이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "perm.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll,ll>
#define F first
#define S second
#define double long double
#define all(x) (x).begin(),(x).end()
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll , null_type , less_equal<ll> ,rb_tree_tag ,tree_order_statistics_node_update >ordered_set;
const int MOD = 1e9 + 7 ;
const int N= 5e5 + 10;
const ll INF= 1e18+10;
struct trp{ll F,S,T;};
ll po(ll x,ll y)
{
ll ans = 1;
while(y){
if( y & 1 ) ans *=x;
y /= 2;
x *=x;
//ans %= MOD;
//x %= MOD;
}
return ans;
}
vector<int> construct_permutation(long long k){
k -- ;
ll ctr = 0;
vector<int>ans;
vector<pair<ll,bool>>g;
for(ll i= 60 ; i > 0 ; i --){
if((1LL << i)-1 <= k ){
if(2*((1LL << i)-1) <= k){
g.pb({i,1});
ctr += i + 1;
break;
}
else g.pb({i,0});
ctr += i;
k -= ((1LL << i)-1);
}
}
for(auto i : g){
ll f = ctr - i.F - i.S ;
if(i.F + i.S == 1){
ans.pb(ctr-1);
ctr --;
continue;
}
for(ll j = f ; j < ctr-2 ; j ++) ans.pb(j);
if(i.S){
ans.pb(ctr-1);
ans.pb(ctr-2);
}
else{
ans.pb(ctr-2);
ans.pb(ctr-1);
}
ctr -= (i.F + i.S);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |