Submission #920473

#TimeUsernameProblemLanguageResultExecution timeMemory
920473SmuggingSpunPermutation (APIO22_perm)C++17
100 / 100
2 ms600 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; vector<int>construct_permutation(ll k){ vector<int>ans; for(int i = 63 - __builtin_clzll(k) - 1, current = 0, front_cnt = 0; i > -1; i--){ ans.emplace_back(current++); if((1LL << i) & k){ if(i > 0 && front_cnt > 1 && ((1LL << (i - 1)) & k)){ ans.emplace_back(current++); ans.insert(ans.begin() + 2, current++); i--; } else{ ans.insert(ans.begin(), current++); front_cnt++; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...