Doraemon and Capoo are playing a game of Bingo this time.
In this version of Bingo, Doraemon and Capoo each start with a blank NxN grid card. Before the game begins, they each write down NxN unique numbers ranging from 1 to 2xNxN on their cards, making sure the other player cannot see their numbers. The goal is to form a straight line of N marked numbers on the grid, which can be horizontal, vertical, or diagonal.
Here's how the game proceeds:
This is a partial judge problem. Write a program to determine the winner of their Bingo game. Please review the provided code and implement the section marked TODO in function.h.
Some hints: The desired number to mark is provided in the format of the number's position on the grid of the player that takes a turn, and it is passed to PlayerA/PlayerB::selectPosition()
. For the implementation of this class method, you have to call myOpponent->selectNumber()
and pass the number that was marked by ourselves, to let the opponent check whether the number is present on their board or not.
Example (N = 3)
This problem consists of several test cases.
Each test case begins with a line containing an integer 5 ≤ N < 8, which indicates the game is played on an N×N grid. The test cases are formatted as follows.
The position that Player A or B marks and announces is formatted as two integers, x and y (0 ≤ x, y < N), which means to mark the number at the position of row x and column y (card[x][y]) on A or B's grid. It is guaranteed that the intended marked position has not been marked on that player's card yet. Please ignore those input positions of numbers that are going to be marked after a bingo line occurs and determine the winner of the round.
The winner of the game will be outputted.