![]() |
||||||||||
|
||||||||||
QueenTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1 Accepted Submission(s): 1 Problem Description As we know, the queen is very strong in Chess. Given an infinite chessboard with one queen and n pawns. Now if all the pawns are frozen and only the queen can move. Obviously, the queen can capture all the pawns in finite steps. But what we want to know is that how many pawns the queen can capture at most if the queen must capture those pawns in the order from 1 to n. Given the positions of the queen and those pawns, answer the question. If you don't know how the queen moves, check the following information: The queen can move in 8 directions with any steps. It must stop after it captures a piece and it can't cross a piece in each move. Input Given an integer in the first line indicating the number of cases. In each case, given an integer n indicating the number of pawns in the first line. In the following n lines, for the ith line, given two integers x and y, indicating the coordinate (x, y) of the ith pawn. The last line in each case show two integers X and Y indicating the coordinate (X, Y) of the queen. 1<=n<=100 -109 <= all the coordinates <= 109 Output For each case, you should output only one line. First, you should output "Case #i: " in which i indicates the case number. Then output the number of the pawns which can be captured at most. Sample Input
Sample Output
Source | ||||||||||
|