ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > IMPC16 Group Contests > задача:


13. 50861 - The largest Student Group

IMPC16 Group Contests

Старт: 16.янв.2016 в 10:00:00
Финиш: 16.янв.2016 в 14:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (4)

Задачи турнира

• 01. 50832 - Rock Paper Scissors Liz...
• 02. 50833 - Min of Odd Positions
• 03. 50834 - The train which leaves ...
• 11. 50859 - Low performance
• 12. 50860 - Number of Student Certi...
• 13. 50861 - The largest Student...
• 14. 50862 - Sum of the Pairs
• 15. 50863 - Total Access Cost of a BST
• 21. 50873 - Max Frequency
• 22. 50874 - Apartment Building Adm...
• 23. 50875 - Take m-out
• 24. 50876 - He is my cousin
• 25. 50877 - Friendly Queue
• 32. 50926 - School Mail Merge

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Jasmin Luka.

The largest Student Group

Your professor wants to find the group which has more excellent students. He wants the students in one group to be counted with the condition that the following student is better than the current. When the following student is worse or equal he creates another group and so on. Then he shows to the class the students of the largest group.

Question: Write a program that gets n-digits and shows the length and the numbers in reverse order of the longest sequence.

A sequence is created when numbers are in increasing order (e.g. 3, 6, 8, 15, 19, ...), then a new sequence starts when the following number is smaller or equal to its previous number in the list (e.g. 3, 6, 8, 15, 19, 4, 6, ...)
When two numbers are the same, 1st number goes to the 1st sequence and the 2nd number starts the new sequence (e.g. 8, 9, 10, 10, 15, 24, 29). First sequence includes 3 numbers (8, 9 and 10) and the second sequence includes 4 numbers (10, 15, 24 and 29).
A sequence may have just one number too (e.g. 3, 0, 1, 9); 1st sequence has just one number (3), and 2nd sequence has numbers (0, 1, 9).

Input specification:
You will be given a number n where n is between 1 and 150. Then, you will be given n integers separated by a comma.

Output specification:
Firstly show the length of the longest sequence. And then show the numbers of that sequence in reverse order. If there are several sequences with the same max length, show the elements of the first one.

Sample Input I
8
8,24,99,99,123,145,4,7
Sample Output I
3
99 24 8

Explanation:
1st Seq. (8, 24, 99) - > 3 Numbers
2nd Seq. (99, 123, 145) - > 3 Numbers
3rd Seq. (4, 7) - > 2 Numbers
1st Seq. and 2nd Seq. have both same length of numbers, so we show the length (3) and the numbers (99 24 8) of the 1st one.



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

www.contester.ru