HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Sorting and sequences > problem:


50745 - Bitonic Sequence

Guest
• Review clarifications (1)

Section problems

• 50509 - Reading Book
• 50934 - Selling Cars
• 50741 - DNA Distance
• 50746 - Most Visited
• 50749 - Min Distance
• 50915 - Trip to Korca
• 50802 - Comparing Exams
• 50927 - Health Expenses
• 50745 - Bitonic Sequence
• 50992 - Top K Obese Classes
• 50447 - Swimming Contest - 2
• 50991 - Intersecting Circles
• 50513 - Climbing Up the Stairs
• 50744 - The Smallest Perimeter
• 51002 - The most successful classes
• 50743 - Total Scholarships Discount
• 50847 - The first m trains to leave

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.
Question by Ibrahim Mesecan.

Bitonic Sequence

Question: Bitonic sequence is a sequence which first increases and then decreases. Write a program that reads a series of numbers. Then, by placing the biggest number to the middle, it converts this series into a bitonic sequence. Note that from the same series, there can be many sequences giving the bitonic property.

Input specification
You will be given an integer (n) where 0 ≤ n ≤ 10,000. Then, you will be given n integers where each of the numbers is less than 1e8.

Output specification
Place the biggest number to the middle of the list. Then, the first part of list will increase, and the second part will decrease.

Sample Input I
5
7 3 6
5 9
Sample Input II
10
19 11 3 5 9 0
4 7 9 18
Sample Output I
3 5 9 7 6
or, 3 6 9 7 5
both comply the bitonic
sequence property.
Sample Output II
0 4 7 11 18 19 9 9 5 3



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

www.contester.ru