Submission #594069

#TimeUsernameProblemLanguageResultExecution timeMemory
594069mohammad_kilaniPermutation (APIO22_perm)C++17
91.33 / 100
3 ms340 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k){ long long num = 1; vector< int > ret; while(num * 2 <= k){ ret.push_back((int)ret.size()); num *= 2; } for(int it = 61;it >= 0;it--){ if(num + (1LL << it) <= k){ num += (1LL << it) ; ret.insert(ret.begin() + it , (int)ret.size()); } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...