## Max and Cards

View as PDF

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Max is a magician whose job is to shuffle magic cards and confuse innocent bystanders. He uses a special deck with cards, labelled from to . Suddenly, he throws his hands up in the air and the cards fall back down in a sorted order (from least to greatest). He then quickly swipes his hands over the cards and forms all possible permutations from lexicographically least to greatest ordered from to . For example, if then he would have made the permutations

1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1

Afterwards, Max asks you questions in the form of what was the permutation that Max made. Since your tiny eyes were too slow to see Max's amazing trick, you try using your old Pentium 4 computer to recreate Max's magic, but can you do it fast enough?

#### Input

The first line will contain .
The second line will contain .
The next lines will contain .

#### Output

For each question, output the permutation on its own line.

#### Scoring

At least 50% of the testcases will have .

#### Sample Input

3
6
5
4
3
2
1
0

#### Sample Output

3 2 1
3 1 2
2 3 1
2 1 3
1 3 2
1 2 3

## Comments

• commented on Jan. 10, 2016, 4:55 p.m.

Judge down right now and I have a solution for partial marks. What do?

• commented on Jan. 10, 2016, 5:03 p.m.

A judge has been made available.

• commented on Jan. 10, 2016, 5:39 p.m. edited

Thanks! Couldn't implement the problem well enough, but extra points are extra points.

Edit: The points are partial, but they aren't showing up under my score.

• commented on Jan. 10, 2016, 5:48 p.m.

Pretty sure it's fixed now.

• commented on Jan. 10, 2016, 5:06 p.m.

Could you give him an extra submission? I think his timer ran out before he could submit for partial.