IMPC16 Group Contests |
Start: Jan.16.2016 at 10:00:00 AM
Finish: Jan.16.2016 at 02:00:00 PM
The contest is finished!
• Contest scoreboard
|
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 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.
Для отправки решений необходимо выполнить вход.
|