LostWorld
Statement
Goal
If you have a map that contains only 2 chars: '#'-earth and '~'-water, you need to output the size of the biggest continent and the number of continents.Input
You know the width, height of the map, and the map.
Output
The size of the biggest continents and the number of continents (each on a row).
Constraints
A continent is determinated by 2 or more adjacent blocks of earth (not diagonal).
A continent can contain only 1 block.
A continent can contain only 1 block.
Example
Input
5 5 # # # ~ ~ ~ ~ # ~ ~ ~ ~ ~ ~ # ~ ~ ~ ~ # ~ ~ ~ # #
Output
4 2
Game modes
Fastest
Test cases
Test 1 Test
Input
5 5
# # # ~ ~
~ ~ # ~ ~
~ ~ ~ ~ #
~ ~ ~ ~ #
~ ~ ~ # #
Output
4
2
Validator 1 Validator
Input
5 5
# # # ~ ~
~ ~ # ~ ~
~ ~ ~ ~ #
~ ~ ~ ~ #
~ ~ ~ # #
Output
4
2
Test 2 Test
Input
3 3
~ # #
# ~ ~
~ # ~
Output
2
3
Validator 2 Validator
Input
3 3
~ # #
# ~ ~
~ # ~
Output
2
3
Test 3 Test
Input
7 7
~ ~ ~ # ~ ~ ~
# # # ~ ~ ~ #
# # # # # # ~
# ~ # ~ # ~ ~
~ ~ ~ ~ ~ ~ ~
# # # ~ # #
~ ~ # # # ~
Output
12
5
Validator 3 Validator
Input
7 7
~ ~ ~ # ~ ~ ~
# # # ~ ~ ~ #
# # # # # # ~
# ~ # ~ # ~ ~
~ ~ ~ ~ ~ ~ ~
# # # ~ # #
~ ~ # # # ~
Output
12
5
Test 4 Test
Input
3 2
~ #
# ~
~ #
Output
1
3
Validator 4 Validator
Input
3 2
~ #
# ~
~ #
Output
1
3
Solution language
Solution
Stub generator input