Permutations

Traditional Problems Lexicographic Ordering Problems

Straight to the problem, if n = 3, then the lexicographic order of the permutation is :

1 2 3 = 1
1 3 2 = 2
2 1 3 = 3
2 3 1 = 4
3 1 2 = 5
3 2 1 = 6
You should've got the idea of what the problem is all about .

Input and Output

There are two subtask for this problem.

Solution : (Yogy Namara)

Humble solution, not fully optimized but works fine...

yogy-n@sby.mega.net.id GeoCities