제출 #975997

#제출 시각아이디문제언어결과실행 시간메모리
975997Orifkhon순열 (APIO22_perm)C++17
10 / 100
1096 ms1468 KiB
#include<bits/stdc++.h> #include "perm.h" using namespace std; #ifdef LOCAL #include "debug.cpp" #else #define debug(...) #endif vector<int> construct_permutation(long long k) { int size = log2(k); vector<int> perm(size); for(int i = 0; i < size; i++){ perm[i] = i; } k-=(1 << size); int insert = size; while(true){ if(k == 0){ break; } int ind = log2(k); k-=(1 << ind); if(ind == 0){ perm.insert(perm.begin(), insert); insert++; continue; } perm.insert(perm.begin() + ind, insert); insert++; } debug(perm); return perm; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...