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