![]() |
||||||||||
|
||||||||||
Let’s play chessTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1 Accepted Submission(s): 1 Problem Description Reversi is a strategy board game for two players, played on an 8×8 board. There are 64 identical game pieces called disks (often spelled "discs"), which are light on one side and dark on the other. Players take turns placing disks on the board with their assigned color facing up. During a play, any disks of the opponent's color that are in a straight line and bounded by the disk just placed and another disk of the current player's color are turned over to the current player's color. The object of the game is to have the majority of disks turned to display your color when the last playable empty square is filled. Now, we simplify this rule, only give you a legal state when it's white turns,and judge whether the white party will win. Spy likes to play Reversi before,but he's very stupid, always lose.Can you help him? Input The input contains multiple test cases. For each case: The first line of the input contains two integers n(2<=n<=20),m(2<=m<=20,n<=m).Next 2~n+1 lines,Each line contains a pair of space-separated positive integers x, y(1<=x, y<=8),represents the position of the white.Next n+2~n+m+1 lines,Each line contains a pair of space-separated positive integers x, y(1<=x, y<=8),represents the position of the black. Output In the first line print "YES" (without the quotes),if white win(the number of white pieces more than the number of black pieces), and the second line print the number that white pieces more than black pieces as much as possible. If white can't win, print in a single line "NO" (without the quotes). Sample Input
Sample Output
Source | ||||||||||
|