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

Турниры > CEN254 Midterm > задача:


1. 51117 - The Most Crowded

CEN254 Midterm

Старт: 09.мая.2017 в 14:05:00
Финиш: 09.мая.2017 в 15:02:00
Турнир завершён!
• Турнирная таблица

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

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

• 1. 51117 - The Most Crowded
• 2. 51118 - Place 7 to the 5th position
• 3. 51119 - Evaluating Prefix express...
• 4. 50836 - Censored

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

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

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

The Most Crowded

You are given a 2D matrix where 0 and negative numbers represent the sea; any other number represent the land. Adjacent land represents the islands. The positive numbers are the number of people living on that section of the island.

Question: Write a program that defines the number of people living on the most crowded island.Note: Two land pieces may be adjacent if they both contain a positive number and share one common border on their four sides (right, left, up and down).

Input specification: You will be given two numbers (n and m) size of the island. Then each of the following n lines contains m integers where the numbers are between -9999 and +9999 and 1 ≤ (n and m) ≤ 100. And there is at least one positive number.

Output specification: Show one integer.

Sample Input Sample Output
4 4
1 -40 11 17
-3 -12 -32 4
-28 -22 -26 -11
8 10 -37 -36
32

Explanation: There are three islands. And, the most crowded island contains (11+17+4) 32 people.



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

www.contester.ru