update
This commit is contained in:
parent
cdc9464526
commit
5547203c8d
@ -26,8 +26,8 @@ void print(Args&&...args){
|
|||||||
(std::cout<<...<<std::forward<Args>(args));
|
(std::cout<<...<<std::forward<Args>(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr std::array<int64, (size_t)1e4+5> log2 = []()constexpr->std::remove_cvref_t<decltype(log2)>{
|
constexpr std::array<int64, (size_t)1e4+5> l2 = []()constexpr->std::remove_cvref_t<decltype(l2)>{
|
||||||
std::remove_cvref_t<decltype(log2)> ret{};
|
std::remove_cvref_t<decltype(l2)> ret{};
|
||||||
ret[1] = 0;
|
ret[1] = 0;
|
||||||
for (const auto &i : std::ranges::views::iota((size_t)2, ret.size())) {
|
for (const auto &i : std::ranges::views::iota((size_t)2, ret.size())) {
|
||||||
ret[i] = ret[i/2] + 1;
|
ret[i] = ret[i/2] + 1;
|
||||||
@ -45,7 +45,7 @@ int main(){
|
|||||||
};
|
};
|
||||||
std::ranges::for_each(std::ranges::views::iota((int64)1, 1ll<<arr.size()), [&arr](auto i){
|
std::ranges::for_each(std::ranges::views::iota((int64)1, 1ll<<arr.size()), [&arr](auto i){
|
||||||
while(i!=0){
|
while(i!=0){
|
||||||
print(arr[log2[lowbit(i)]], ' ');
|
print(arr[l2[lowbit(i)]], ' ');
|
||||||
i-=lowbit(i);
|
i-=lowbit(i);
|
||||||
}
|
}
|
||||||
print('\n');
|
print('\n');
|
||||||
|
Loading…
Reference in New Issue
Block a user