497 - 暑訓比賽 (2013/08/24) ICPC 2009 Dhaka Scoreboard

Time

2013/08/24 09:25:00 2013/08/24 14:25:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

3003 - (*) Tic Tac Toe   

Description

The game of Tic Tac Toe is played on an n-by-n grid (where n is usually but not necessarily three). Two players alternate placing symbols on squares of the grid. One player places Xes and the other player places Os. The player placing Xes always goes first. When the grid contains a vertical, horizontal, or diagonal sequence of at least m consecutive squares all containing the same symbol, the game ends and the winner is the player who placed the last symbol. When all the squares of the grid are filled, if neither player has won, the game ends in a draw.

Your task is to analyze the state of a Tic Tac Toe board, and determine whether the game is still in progress, or if it has completed, who won, or if the game ended in a draw. You should also detect erroneous states of the Tic Tac Toe board that could never occur during an actual game.

Input

The first line of input contains a single integer, the number of test cases to follow. The first line of each test case contains the two integers n and m, separated by spaces, with 1 <= m <= n <= 1000. The following n lines of the test case each contain one row of the Tic Tac Toe board. Each of these lines contains exactly n characters, and each of these characters is either an X, an O, or a period (.), indicating an empty square.

Output

For each test case, output a single line containing the appropriate string X WINS, O WINS, or DRAW if the game is over, the string IN PROGRESS if the game has not yet finished, or ERROR if the state of the board could never occur during a game.

Sample Input  Download

Sample Output  Download

Tags




Discuss




3378 - (*) Perfection   

3379 - (*) Uniform Generator   

3380 - (*) Soundex   

3381 - (*) Mine Sweeper   

3382 - (*) Prerequisites?   

3383 - (*) Save Hridoy   

3384 - (*) Find the Telephone   

3385 - That is Your Queue   

3386 - How Many Ones Needed?   

3387 - Foot Notes   

3388 - A Match Making Problem   

3389 - Games of Block   

3390 - Password Remembering   

3391 - Camera in the Museum   

3392 - Traffic Jam   

3393 - Rectangle of Permutation   

3394 - How Many bases?   

3395 - Integer Game   

7032 - (*) Rock, Scissors, Paper   

Description

Bart's sister Lisa has created a new civilization on a two-dimensional grid. At the outset each grid location may be occupied by one of three life forms: Rocks, Scissors, or Papers. Each day, differing life forms occupying horizontally or vertically adjacent grid locations wage war. In each war, Rocks always defeat Scissors, Scissors always defeat Papers, and Papers always defeat Rocks. At the end of the day, the victor expands its territory to include the loser's grid position. The loser vacates the position.
Your job is to determine the territory occupied by each life form after n days. The first line of input contains t, the number of test cases. Each test case begins with three integers not greater than 100: r and c, the number of rows and columns in the grid, and n. The grid is represented by the r lines that follow, each with c characters. Each character in the grid is R, S, or P, indicating that it is occupied by Rocks, Scissors, or Papers respectively.

For each test case, print the grid as it appears at the end of the nth day. Leave an empty line between the output for successive test cases.

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




7494 - (*) WERTYU   

Description

 

打字時一個常見的錯誤就是沒有把手放在正確位置,而是偏右邊一個位置。所以會發生Q被打成W,J被打成K等等的情況。你的任務就是要把打錯的字修正回來。

Input

輸入包含許多列,每列可能包含有數字,空白字元,大寫英文字母(Q、A、Z除外),標點符號(`除外)。

Output

對每一列中的每個字元,請輸出在鍵盤(如上圖)上其左邊一個位置的字元。但是輸入中的空白字元,輸出時亦請輸出空白字元。

Sample Input  Download

Sample Output  Download

Tags




Discuss