HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50745 - Bitonic Sequence

Guest
• Review clarifications (1)

Volume problems

• 50658 - The Message
• 50766 - Word Puzzle
• 50934 - Selling Cars
• 50746 - Most Visited
• 50749 - Min Distance
• 50915 - Trip to Korca
• 50985 - Books Waiting
• 50927 - Health Expenses
• 50745 - Bitonic Sequence
• 51083 - Grades Histogram
• 50789 - Number of Cities
• 50983 - Course Selection
• 51024 - Total Stock Price
• 50987 - Very Looong Queue
• 50913 - Manhattan Distance
• 51008 - Sum of Regional Maxes
• 50729 - Max number in 2D array

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