Submission #805690

#TimeUsernameProblemLanguageResultExecution timeMemory
805690BT21tataPermutation (APIO22_perm)C++17
10 / 100
199 ms262144 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-(1<<(mx+1))>=0) { v.pb(++mx); k-=(1<<mx); } for(int i=v.size()-1; i>=0; i--) { if(k-(1<<(v[i]))>=0) { k-=(1<<(v[i])); v.insert(v.begin()+i, ++mx); } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...