QQ Game About LianLian Kan
As we all know, lfq198502 likes to play the LianLian Kan game very much.
During the LianLian Kan game, so long as the same color of the two cards can be linked together with no more than three straight lines,they will be eliminated,the rules simple and easy to use.
Operations: The first use of mouse clicks a pawn in the chessboard, the pawn is "checked" at this moment with a special display;the mouse clicking another pawn again, if the pawn of pattern is the same as the "checked" pawn,and the two pawns can be linked together with no more than three straight lines, this pair of pawns will be eliminated;otherwise the first pawn was not "checked", and the second one was "checked".
Here,we can imagine the LianLian Kan’s interface into a plane with 10 × 10 blocks, each block is a type of pictorial or empty.The sake of simplicity, we use different characters representing different patterns, a space means that there is no pattern. Given the initial interface of game and the records that lfq198502’s mouse clicked the coordinates in the course of the game,your task is to judge whether he can eliminate all the patterns or not after these actions.
Each test case contains two parts:
The first part: ten lines of strings and each line contains ten characters (a space character indicates that there is no pattern at this block and each other character stands for one pattern),indicating the initial interface.
The second part: an integer n on the first line,indicating how many times that lfq198502’s mouse clicked; then n lines followed,each line with two integers x,y(1≤x≤10, 1≤y≤10), indicating the row and column postion of a mouse click.
2 abccba x bax ab 8 8 @ ( ( @ 18 1 3 1 4 1 2 1 5 1 1 1 6 1 10 2 3 2 2 3 2 3 3 2 1 3 7 4 10 8 1 10 7 10 3 8 10 ab 8 ba 8 @ @ 8 1 1 2 2 1 2 2 1 1 10 4 10 8 1 10 7
Yes,all patterns are eliminated! No,4 pattern(s) are left!