제출 #932789

#제출 시각아이디문제언어결과실행 시간메모리
9327898pete8순열 (APIO22_perm)C++17
91.33 / 100
2 ms348 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include "perm.h" #include<cstring> #include<cassert> #include<limits.h> #include<cmath> #include<set> #include<numeric> //gcd(a,b) #include<algorithm> #include<bitset> #include<stack> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define pppiiii pair<pii,pii> #define ppii pair<int,pii> #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound //#define fastio ios::sync_with_stdio(false);cin.tie(NULL); //#pragma GCC optimize ("03,unroll-loops") //#define int long long //const int mod=1e9+7,mxn=2e5,lg=30,inf=1e18,minf=-1e18,Mxn=2e6,root=700; bool cmp(pii a,pii b){ if(a.f!=b.f)return a.f<b.f; return a.s>b.s; } vector<int> construct_permutation(ll k){ vector<pii>ans; vector<int>ra; int g=0; for(int i=62;i>=0;i--)if(k&(1ll<<i)){ g=i; break; } int cnt=g-1; for(int i=0;i<g;i++)ans.pb({i,i}); for(int i=g-1;i>=0;i--){ if(k&(1ll<<i))ans.pb({i,++cnt}); } sort(all(ans),cmp); for(auto i:ans)ra.pb(i.s); return ra; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...