HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Data Structures > problem:


50506 - The Biggest Island

Guest
• Review clarifications (3)

Volume problems

• 50688 - Epoka Furgon
• 50750 - Service Time - 2
• 50706 - The most crowded Club
• 50689 - The biggest building block
• 50686 - The Container
• 50771 - BST Level Sum
• 50773 - Balanced Sum Tree
• 50536 - Epoka Furgon Shpk
• 50506 - The Biggest Island
• 50682 - Hotel Durres
• 50777 - Dwarfs Maze
• 50488 - Connecting Wires
• 50472 - Minimum Sum Triangle
• 50842 - Minimum Sum Triangle - DP
• 50781 - ReversesreveR
• 50676 - Cinema Millennium
• 50780 - Hot Potato - Revisited

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.

The Highest Peak of the Biggest Island

Indonesia is known as the country with the most number of islands. There are around 17,000 islands there. According to a new plan, government wants to build a new army base on one of the biggest islands. Because there are too many islands, it's difficult to make an on site research through the islands.

For this purpose, they have taken satellite images and want to find the biggest island. Satellite images are nxm rectangular images having positive and negative integers. Positive integers represent the land spaces while zero and negative values represent sea.

Question: Write a program that accepts a rectangular satellite image and finds the area of and highest peak of the biggest island.
Note: None of the biggest area is bigger than 500.

Input specification
You will be first given two integers (n and m) which are sides of the rectangular image. Then, the following n lines will have comma separated m integers where 1 ≤ (n, m) ≤ 150. The integers in the rectangle vary between -200 and +200.

Output specification
Show two integers:

  • the area of the biggest island
  • the highest peak of it
Note: If there are several islands with the same area show the one highest peak.

 Sample Input   
 6 6
 45, 30, -1, 2, 13, 24,
 25, 17, -6, 5, 17, 30,
 0, 3, -7, -2, 15, 32,
 -6, -8, -1, -3, -2, 5,
 -1, 5, -2, 3, 3, -4,
 4, 8, -1, 5, 6, -17,
 Sample Output   
 9 32


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

www.contester.ru