I. Побачення

Вибачте, але цю сторінку ще не перекладено на українську мову For the sake of viewer convenience, the content is shown below in one of the available alternative languages. You may click one of the links to switch the site language to another available language.

2 sec, 256 M

Your friend Antip Verbiage is waiting for the date with his classmate Ilona Magazine. He wants to present her an array of 2∙N numbers. He wants the minimal difference between any two consecutive numbers be as maximal as possible. But what a doubt! The sequence he bought is sorted! Help him to rearrange the numbers in the sequence.

Input. The first line contains a natural number N (1 ≤ N ≤ 500). The next line contains 2∙N sequence elements (from 1 to 1000000) sorted in ascending order.

Output. If required difference is greater than 1, output it at the first line and a new sequence at the second one. (If there are many right sequences output the most attractive for Ilona in your opinion one) Print the only line “Forever Ilona” otherwise.

Input Output
2

1 2 3 10

2

1 3 10 2

2

1 2 2 10

Forever Ilona

 

Idea – Arthur Leonidovich Maximov

About the post author Igor Mazurok (5 Posts)

PhD in Computer Science, Associate professor of Department Applied Mathematics of Odessa I.I.Mechnikov National University, Ukraine KBIS Software Developer

Author Info

Igor Mazurok

PhD in Computer Science, Associate professor of Department Applied Mathematics of Odessa I.I.Mechnikov National University, Ukraine
KBIS Software Developer

One thought on “I. Побачення

Leave a Reply