Submission #805693

#TimeUsernameProblemLanguageResultExecution timeMemory
805693BT21tataPermutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h" #include<bits/stdc++.h> typedef long long ll; #define pb push_back using namespace std; vector<int> construct_permutation(ll k) { vector<int>v; ll mx=0; k-=2; v.pb(0); while(k-(1ll<<(mx+1))>=0) { v.pb(++mx); k-=(1ll<<mx); } for(int i=v.size()-1; i>=0; i--) { if(k-(1ll<<(1ll*v[i]))>=0) { k-=(1ll<<(v[i])); v.insert(v.begin()+i, ++mx); } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...