HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Exhaustive search & Backtracking > problem:


50506 - The Biggest Island

Guest
• Review clarifications (3)

Section problems

• 50717 - Hurdle Jumping
• 50840 - Tanker trucks
• 50490 - Across the River
• 50828 - Arranging Time Table
• 51067 - Jumping frog
• 51142 - Jump Min Value
• 51082 - Sum is equal to K - 1
• Post Office Delivery
• 50506 - The Biggest Island
• 50718 - Elevator
• 50593 - Transporter
• 50600 - Expression
• 50720 - Permutations (2)

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