Question: need your help to solve this problem! within the time and memory limit. all my attempts exceed the memory limit. please consider using space proportional

need your help to solve this problem! within the time and memory limit. all my attempts exceed the memory limit.
please consider using space proportional to input size, rather than the largest input number.
 need your help to solve this problem! within the time and
memory limit. all my attempts exceed the memory limit. please consider using

A. Stake Your Claim time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Grab the biggest space! Identify and claim the biggest space before your rivals! Stake Your Claim is a four-player minigame in Super Mario Party, and you can view how the game is actually played here. The game is actually quite simple-a rectangle board is given with boundary edges that divide up the board into four regions. Each player selects a section to claim it, and your goal is to pick the region with the largest area. However, the board gets larger and larger as the game goes on, and in many cases, it is not easy for a human to tell which region is the largest. The goal here is to write a computer program to compute the areas for the four sections. Input The first line of the input contains two integers, r and c(0r,c103), indicating the number of rows and columns of the board. Then you are given 2r+1 lines, each containing 2c+1 characters. Each character is either a dot "* (for empty cels), "-" for horizontal edgas), " " "(for vertical edges), and " + " (for comers), Characters in odd columns and odd rows are walls and do not count for areas. Characters in even columns and even rows are the actuai cells that count for areas. You can go to the note for more details on how the areas are counted for the sample input instance. Output The output only contains 4 integers, indicating the areas in decreasing order. Note The sample input exactly describes the game in the above image. The four sections are: AAAAAABBB 1++++++++1 A,A,ACAB,B,B,B ++,1,1,1,++,1 C,CACABDB:B DC,C,C,C.CD.DB 1.1++1.+1.1 D+DDDDDDBB Here the areas for sections A, B, C, and D are 12, 13, 9, 11, respectively, Here we use " A ", "B", "C" and " D " to denote the four areas. Here ". means empty (no wall between two cells) that doesn't count in area. , or "Y mean walls

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!