F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Queen

Time 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
1 15 2 2 10 10 3 1 4 1 4 2 4 3 4 4 3 4 2 4 1 4 1 3 1 2 1 1 2 1 20 20 3 3
 

Sample Output
Case #1: 1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2025-03-29 01:44:54, Gzip enabled