Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this question i think it can be solved by using graph theory A. Stake Your Claim time limit per test: 1 second 0 memory limit

image text in transcribed

image text in transcribed

this question i think it can be solved by using graph theory

A. Stake Your Claim time limit per test: 1 second 0 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 cells), "-" (for horizontal edges), " | " (for vertical edges), and "+" (for corners). Characters in odd columns and odd rows are walls and do not count for areas. Characters in even columns and even rows are the actual 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 +++.++ AAACABBBB +++.++ C.CACABDBB ++.++.+++.++.1 DCCCCCDDB I.t-on-o-o-t.t-+.1 DDDDDDDBB 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 " " mean walls

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions