5889: 【系列题】回溯(十二)全排列2

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:5 Solved:0

Description

给定一个长度为 n 的可包含重复数字的序列 a[] ,按 从小到大顺序 输出所有不重复的全排列。

Input

第一行一个整数n。

第二行n个整数a[i]。

Output

按 从小到大顺序 输出所有不重复的全排列。

每个排列一行。

Sample Input Copy

3 
1 2 1

Sample Output Copy

1 1 2 
1 2 1 
2 1 1 

HINT

数据范围:

  • 1 <= n <= 8
  • -10 <= a[i] <= 10