CEN112 Homeworks 2013-2015 |
Start: Dec.15.2013 at 12:00:00 PM
Finish: Dec.15.2013 at 05: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 Ibrahim Mesecan.
Reading Book
Your sister has a reading competition in
her school. But she has difficulties in reading.
She prefers the books which has more pictures in
it. Before she starts reading she takes notes
of the pages with pictures. If there are several pictures
consecutively, she becomes happy. If there are many pages
without pictures, it's a difficult part to read.
Question:
Write a program that reads page number of pictures
for n books and defines the book which has a picture
after the most number of pages.
Input specification
You will be given an integer in the beginning:
the number of books (k where 1 ≤ k ≤ 4,000 ).
Then in the following
k lines, you will be given several integers (page numbers
of pictures) where each number is between 1 and
30,000 (books like encyclopedia :) ending with a
negative number. After the negative number you will
be given total number of pages of the book.
The books might have at most 500 pictures.
Output specification
Show the id of the book which contains the
most difficult part. (The most number of
consecutive pages without picture.)
Note: 1) Page ids start from 1
2) If there are several books with the same
max number of consecutive pages show the id of
the first book.
Sample Input I
3
5 4 7 -2 10
2 15 7 9 3 -2 20
2 7 4 8 -2 10
|
Sample Output I
2
|
Explanation:
-
The first book has
10 pages and it has the pictures on pages 4, 5, and 7.
There are 3 consecutive pages at most without any picture.
- The second book has 20 pages and it has the
pictures on pages 2, 3, 7, 9 and 15. There are at most 5
consecutive pages without any picture.
-
The third book has 10 pages and it has the
pictures on pages 2, 4, 7, and 8. There are at most 2
consecutive pages without any picture.
As a result, the second book has the most number of
consecutive pages without any picture.
Для отправки решений необходимо выполнить вход.
|