Question: C++ Language Ivan is a novice painter. He has n dyes of different colors. He also knows exactly m pairs of colors which harmonize with

C++ Language

C++ Language Ivan is a novice painter. He has n dyes of

different colors. He also knows exactly m pairs of colors which harmonize

with each other. Ivan also enjoy playing chess. He has 5000 rooks.

He wants to take k rooks, paint each of them in one

Ivan is a novice painter. He has n dyes of different colors. He also knows exactly m pairs of colors which harmonize with each other. Ivan also enjoy playing chess. He has 5000 rooks. He wants to take k rooks, paint each of them in one of n colors and then place this k rooks on a chessboard of size 109 x 109. Let's call the set of rooks on the board connected if from any rook we can get to any other rook in this set moving only through cells with rooks from this set. Assume that rooks can jump over other rooks, in other words a rook can go to any cell which shares vertical and to any cell which shares horizontal. Ivan wants his arrangement of rooks to have following properties: For any color there is a rook of this color on a board; For any color the set of rooks of this color is connected; For any two different colors a b union of set of rooks of color a and set of rooks of color b is connected if and only if this two colors harmonize with each other. Please help Ivan find such an arrangement. Input n(n-1) 7")) The first line of input contains 2 integers n, m (1

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!