АВТ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

58. One Step to QuickSort

Time Limit: 1 seconds
Memory Limit:64000KB
Points:2
View Problem Statistics Submit Problem added Administrator

Переставить элементы произвольного массива из n (n<100) элементов таким образом, чтобы все элементы, которые меньше первого элемента, оказались впереди его, остальные, естественно, окажутся сзади его. Перестановки выполнять строго по порядку слева направо, чтобы не нарушить относительное расположение элементов друг относительно друга в каждой группе.

Input

Первая строка содержит количество элементов массива n.

Затем следуют элементы массива (целые числа), каждый в отдельной строке.

Output

Вывести массив с переставленными элементами. Каждый элемент в отдельной строке.

Если массив пустой, то не выводится ничего.

Sample

InputOutput
20
291
251
291
313
251
251
313
251
313
251
251
251
291
251
251
251
251
251
313
291
251
251
251
251
251
251
251
251
251
251
251
251
291
291
313
313
313
291
313
291

View Problem Statistics Submit Author/source:
Educational Courses / Programming and Basics of Algorithmization / Others /
913. Numbers with different digits 58. 56. Remove Numbers 57. Same Numbers
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 0.031 sec.
© Copyright VSTU, AVT, Nosov D.A.