제출 #931074

#제출 시각아이디문제언어결과실행 시간메모리
931074sleepntsheep순열 (APIO22_perm)C++17
0 / 100
0 ms348 KiB
#include "perm.h" #include <stdio.h> #include <algorithm> std::vector<int> construct_permutation(long long k) { std::vector<int> v; int msb = 63 - __builtin_clzll(k); for (int i = 1; i <= msb; ++i) v.push_back(i*2); k &= ~(1ll << k); for (int i = msb - 1; i >= 0; --i) { if (k & (1ll << i)) { v.push_back(i*2-1); } } auto w = v; std::sort(w.begin(), w.end()); for (int &x : v) x = std::lower_bound(w.begin(), w.end(), x) - w.begin(); //for (int x : v) printf("%d ", x); return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...