Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ code Aybala and Nurbike are close friends. When they spend time together, they love to go to museums and look at the paintings exhibited

image text in transcribed

c++ code

Aybala and Nurbike are close friends. When they spend time together, they love to go to museums and look at the paintings exhibited there. In the museums where Aybala and Nurbike go, only square paintings are exhibited and there are only 3 colors in these paintings, which are Red (R), Blue (B), and Green (G). While Aybala can see all colors perfectly, Nurbike cannot distinguish between Red and Green. The color of image pixel is indicated by a single character: R (Red), G (Green), and B (Blue). Also, two characters having the same color belong to the same region if they are directly adjacent (that is, they are located at the east, west, north, or south of each other). As an example, consider the following 55 image: RRRBB GGBBB BBBRR BBRRR RRRRR When viewed by Aybala, the image has 4 regions ( 2 red, 1 blue and 1 green), but when viewed by Nurbike there are only 3 regions in the image ( 2 red-green, 1 blue). We would like you to find the number of regions that Aybala and Nurbike can see in the input images of size NxN. INPUT FORMAT: - Line 1: The integer N. - Each of the N following lines contains a string of N characters. Each character of this sequence specifies the color of that region. OUTPUT FORMAT: Print two integers with a space between them on a single line. These are the number of regions Aybala and Nurbike can see, respectively. Constraints 1

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago