#P12111. [NWRRC2024] Game of Annihilation

    ID: 12030 Type: RemoteJudge 2000ms 1024MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>2024Special JudgeICPCNWRRC

[NWRRC2024] Game of Annihilation

题目描述

Two players are playing a game on a tape divided into cells that is infinite to the right. The cells are numbered with 1,2,3,1, 2, 3, \ldots from left to right. Each cell xx is adjacent to cells x1x - 1 and x+1x + 1, except for cell 11, which is only adjacent to cell 22.

There is a finite number of red chips (the first player's chips) and blue chips (the second player's chips) on the tape. Each cell contains either several red chips, or several blue chips, or no chips at all.

The players take turns. On their turn, a player can either skip the turn or take one of their chips and move it to an adjacent cell. If there are no opponent's chips in the adjacent cell, the turn ends; if there is at least one opponent's chip there, one chip from each player is removed from that cell --- thus, at the end of the turn, there will still be no two chips of different colors in the same cell.

If both players run out of chips, the game ends in a draw. If only one player runs out of chips, they are declared the loser, and their opponent is declared the winner. Finally, if after 1010010^{100} turns the game has not ended, it is forcibly concluded and declared a draw.

You are given the initial setup of the tape. Determine who will win with perfect play from both players, and find any optimal first move for the first player.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

The first line of each test case contains a single integer nn, denoting the number of cells that initially contain at least one chip (2n21052 \le n \le 2 \cdot 10^5).

The ii-th of the following nn lines contains two integers xix_i, mim_i, and a character cic_i, denoting the coordinate of the ii-th non-empty cell from the left, the number of chips in it, and the color of these chips (1x1<x2<<xn1061 \le x_1 < x_2 < \cdots < x_n \le 10^6; 1mi1061 \le m_i \le 10^6; ci{R,B}c_i \in \{\mathtt{R}, \mathtt{B}\}). There is at least one chip of each color on the tape.

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^5.

输出格式

For each test case, print:

  • First\texttt{First} xx dd, if the first player (moving red chips) will win;
  • Second\texttt{Second}, if the second player (moving blue chips) will win;
  • Draw\texttt{Draw} xx dd, if the outcome of the game will be a draw.

In the first and third cases, xx dd specifies any winning or drawing move, respectively --- that is, a move after which, with perfect play from the second player, there remains a possibility to win or draw the game. Here, xx is the coordinate of the red chip that the first player should move, and d{-,+}d \in \{\texttt{-}, \texttt{+}\} is the direction of the move (-\texttt{-} means the chip should be moved to cell x1x - 1, and +\texttt{+} means the chip should be moved to cell x+1x + 1). If dd is -\texttt{-}, then xx must be greater than 11. If you suggest that the first player skips their turn, print 0 0\texttt{0 0} instead of xx dd.

You can print each letter in upper- or lowercase: for instance, the strings First\texttt{First}, FIRST\texttt{FIRST}, fiRST\texttt{fiRST} will be considered equivalent by the checker.

10
2
1 1 R
2 1 B
2
1 1 B
2 1 R
2
1 2 B
4 1 R
4
1 1 B
2 1 R
4 3 B
6 1 R
2
1 2 B
3 1 R
2
1 2 B
2 1 R
2
1 1 R
2 2 B
2
1 2 R
3 1 B
3
1 1 R
2 1 R
4 1 B
2
1 2 R
2 1 B
Draw 0 0
Draw 2 -
Draw 4 -
Draw 2 -
Draw 0 0
Draw 2 +
Second
Draw 0 0
Draw 2 -
First 1 +

提示

In the last test case, there is only one possible move besides 1 +\texttt{1 +}, namely, 0 0\texttt{0 0} (skip the turn). It is a drawing move, though; hence, it will not be accepted.