Codeforces Round #712 3-Coloring - Game & Implementation

Solution

Fixed two colors cross-painted until one of the colors fills the half of the map. After that, the remaining half can be filled with one of the remaining two colors base on the input.

So base on first two inputs. We can give $map[0][0]$ and $map[0][1]$ two different color. After that, all the input only can be one of these two color. So we use the remaining colors to paint the map in the directions of the four corners. Then we can get result blow:

One color is cross-painted in half

For the white cell which is not painted. We just paint with the different color with Alice input.

Not sure if any other solutions. This solution is a bit complex to implement.


Code

Get WA once because of Java language. If LinkedList is empty,when call the removeFirst method it will throw a exception.

Submission #112017962 - Codeforces
Codeforces. Programming competitions and contests, programming community
Show Comments
DigitalOcean Referral Badge