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

Турниры > CEN112 Homeworks 2013-2015 > задача:


15-SprPr2-20. 50509 - Reading Book

CEN112 Homeworks 2013-2015

Старт: 15.дек.2013 в 12:00:00
Финиш: 15.дек.2013 в 17:00:00
Турнир завершён!
• Турнирная таблица

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

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

• 14-Spr2-20. 50442 - Polynomial Add...
• 14-Spr2-40. 50361 - Align Two Lists
• 14-Spr2-50. 50616 - Змейка
• 14-Spr2-60. 50444 - n digit kth nu...
• 15-SprHW-20. 50446 - Snake
• 15-SprHW-30. 50788 - Eight Puzzle
• 15-SprHW-40. 50746 - Most Visited
• 15-SprHW-60. 50516 - Lines
• 15-SprPr2-20. 50509 - Reading ...
• 15-SprPr2-60. 50766 - Word Puzzle
• 15-SprPr2-80. 50786 - Top Question
• 15-SprPrE1-20. 50785 - Swimming ...
• 15-SprPrE1-40. 50748 - Gold Store
• 15-SprPrE1-70. 50507 - Sequential ...
• 15-SprResit-20. 50447 - Swimming ...

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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.


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

www.contester.ru