제출 #660606

#제출 시각아이디문제언어결과실행 시간메모리
660606Bovmelo순열 (APIO22_perm)C++17
100 / 100
2 ms340 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; vector<int> construct_permutation(long long k) { vector<int> a; int c = 0, t = 0; for (int i = __lg(k) - 1; ~i; i--) { a.push_back(t++); if (k >> i & 1) { if (i > 0 && (k >> (i - 1) & 1) && c > 1) a.push_back(t++), a.insert(a.begin() + 2, t++), i--; else a.insert(a.begin(), t++), c++; } } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...