Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the coloring game on C++

Shulou Source: shulou.com Published: 2022-06-03 05:04:31 11月16日 Update

C++ how to achieve coloring games, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

On a 2*N grid, Alice and Bob begin a new game journey.

Alice and Bob take turns coloring in these cells, using two coloring tools, the first to color any cell, and the second to color any 2*2 cell. In each round, they can choose a tool to color the uncolored squares. Note that when coloring 2*2 cells, all 4 cells should be uncolored. The player who paints all the squares in the last step wins.

As always, Alice goes first, optimal strategy, who wins? Input The first line T indicates that there are T sets of test data. Each set of data contains two numbers, N and M, where M indicates how many cells have been colored. The next M rows have two numbers Xi and Yi in each row, indicating the coordinates of the grid that have been colored.

[Technical Specification]

1. 1

Tags: Grid data spaces two coordinates tools numbers winners help dyeing output Clearing ordinary clear as always next one line journey first hand content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Microsoft Redmi Xiaomi NVidia