Answered step by step
Verified Expert Solution
Question
1 Approved Answer
INPUT: 6 1 1 1 1 1 5 2 1 2 2 1 1 1 2 2 1 1 1 2 3 3 2 2
INPUT: 6 1 1 1 1 1 5 2 1 2 2 1 1 1 2 2 1 1 1 2 3 3 2 2 2 2 2 2 2 3 2 10 5 7 3 2 1 7 9 4 2 7 9 9 9 2 1 4 9 4 2 3 9 9 9 7 4 3 5 2 1 2 2 1 1 1 2 2 1 1 3 3 6 4 3 4 2 4 1 2 2 3 1 3 1 1 2 2 3 4
OUTPUT: YES 1 YES 2 2 YES 1 1 1 YES 2 1 9 5 9 NO NO
SOLVE THIS PROBLEM IN C++
You finally woke up after this crazy dream and decided to walk around to clear your head. Outside you saw your house's fence so plain and boring, that you'd like to repaint it. *** You have a fence consisting of n planks, where the i-th plank has the color ai. You want to repaint the fence in such a way that the i-th plank has the color bi You've invited m painters for this purpose. The j-th painter will arrive at the moment j and will recolor exactly one plank to color ej. For each painter you can choose which plank to recolor, but you can't turn them down, i. e. each painter has to color exactly one plank. Can you get the coloring b you want? If it's possible, print for each painter which plank he must paint. Input The first line contains one integer t (1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started