Gửi bài giải
Điểm:
0,50
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Dạng bài
Ngôn ngữ cho phép
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch
Trong trường hợp đề bài hiển thị không chính xác, bạn có thể tải đề bài tại đây: Đề bài
Sample Input 1
1
4 2
Sample Output 1
2 1 3 4
Bình luận
can someone hint some idea for this problem D? just about constructive algo with the power of 2 or some others?
Use powers of 2 to count how many good permutations there are. Then use binary search to decide which number to choose next when building the final permutation