F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Number game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 303    Accepted Submission(s): 36


Problem Description
One day, QQ is playing a number game. He first sorts the N numbers 1, 2, 3¡­n, but this is too easy. So long1 wants to challenge QQ¡¯s skill, he let the number sequence becomes wavy. For example, a1<a2>a3<a4>a5¡­ or a1>a2<a3>a4<a5¡­.
Now long1 sorts these wavy sequences by lexicographic order, and he wants to know what the M-th sequence is when you have N numbers.
As an Acmer, long1 thinks you can solve it and gives him the answer.
 

Input
There are many test cases:
For every case:

First line is the number of case
The next case lines:
Every line contains two numbers N, and M.(1<=N<=20,M is not larger than the number of wavy sequences)
 

Output
For every case, output the sequence.
 

Sample Input
2 2 1 3 3
 

Sample Output
1 2 2 3 1
 

Hint

Hint: You can assume that the number of total wavy sequences will not beyond INT64.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 15:41:33, Gzip enabled