Submission #577163

#TimeUsernameProblemLanguageResultExecution timeMemory
577163NintsiChkhaidzePermutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h" #include <bits/stdc++.h> //#include <vector> #define pb push_back #define ll long long using namespace std; vector<int> construct_permutation(long long k){ int l = 0; for (int i = 60; i >= 0; i--) if (((1LL<<i)&k)) {l = i; break;} vector <int> v; v.clear(); for (int i=0;i<l;i++) v.pb(i); ll val = l - 1; for (int i = l-1; i >= 0; i--) if (((1LL<<i)&k)) v.insert(v.begin() + i, ++val); return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...