제출 #1235204

#제출 시각아이디문제언어결과실행 시간메모리
1235204dizzy_groovy순열 (APIO22_perm)C++20
10 / 100
400 ms327680 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { vector<int> p; int cur = 1; for (int i = 0; (1 << (i + 1)) <= k; i++) { cur *= 2; p.push_back(i); } int n = p.size(); while (k - cur > 0) { int x = __lg(k - cur); for (auto &i : p) { if (i >= x) i++; } p.push_back(x); cur += (1 << x); } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...