HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Exhaustive search & Backtracking > problem:


50710 - Permutations

Guest
• Discussion of problem (1)

Section problems

• 51071 - Phalanx-2
• 50715 - Zero Sum
• 50711 - Snail Trails
• 50472 - Minimum Sum Triangle
• 50306 - Beautiful Numbers
• 50716 - All Palindromes
• 50714 - The knight
• 50713 - Castle and the girls
• 50710 - Permutations
• 50709 - k-ary Strings
• 50708 - Binary Strings
• 50996 - Checkers - the shortest path
• Check-Mate
• 50479 - Bit Compressor
• 50486 - Problems and Programmers
• 50712 - Moon algebra
• 50717 - Hurdle Jumping

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Permutations

Question: In mathematics, permutation relates to the rearrangment of all the members of a set into some sequence or order. Write a program that generates all the permutations of a set of n people.

Input specification
You will be given an integer n. And in the following n lines you will be given the names of n people where 0 ≤ n ≤ 8. Names contain only English uppercase or lowercase characters.

Output specification
Show all possible rearrangements for this n people. Show for every possible arrangment of n people in a line, separated by spaces.

Sample Input I   
3
Red
Green
Blue
Sample Input II   
4
Anila
Erol
Bardhyl
Erisa
Sample Output I   
Red Green Blue
Red Blue Green
Green Red Blue
Green Blue Red
Blue Red Green
Blue Green Red
Sample Output II   
Anila Erol Bardhyl Erisa
Anila Erol Erisa Bardhyl
Anila Bardhyl Erol Erisa
Anila Bardhyl Erisa Erol
Anila Erisa Erol Bardhyl
Anila Erisa Bardhyl Erol
Erol Anila Bardhyl Erisa
Erol Anila Erisa Bardhyl
Erol Bardhyl Anila Erisa
Erol Bardhyl Erisa Anila
Erol Erisa Anila Bardhyl
Erol Erisa Bardhyl Anila
Bardhyl Anila Erol Erisa
Bardhyl Anila Erisa Erol
Bardhyl Erol Anila Erisa
Bardhyl Erol Erisa Anila
Bardhyl Erisa Anila Erol
Bardhyl Erisa Erol Anila
Erisa Anila Erol Bardhyl
Erisa Anila Bardhyl Erol
Erisa Erol Anila Bardhyl
Erisa Erol Bardhyl Anila
Erisa Bardhyl Anila Erol
Erisa Bardhyl Erol Anila


Для отправки решений необходимо выполнить вход.

www.contester.ru