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

Pirates of the Caribbean

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65768/32768 K (Java/Others)
Total Submission(s): 473    Accepted Submission(s): 98


Problem Description
Let¡¯s put our eyes on the Caribbean Sea, where the pirates are most active among all, and where our story occurs. This mysterious sea is located at the southeast side of the North America with beautiful blue sky, warm sunshine and crystal clear seawater. Here is a must-pass for those who wanted to reach America from Europe in 17th century, so the pirates are quite rampant back then. They attack the merchants, the passersby and even the royal armada of British.
The rule breaker, the undeterminable Nono, a young pirate recently appears actively at Caribbean Sea, with his terrifying pirate ship ¡°Black Panda¡±, robs bamboos from merchant ships.

There are N islands in Caribbean Sea, numbered 1,2¡­N, the ith island is located at (xi, yi). In order to rob the merchant ships, Captain Nono travels among these N islands very often. Nono is very good at physics and math as they are basic surviving skills for pirates. For example, he knows that between two points, straight line is the shortest path. So he will choose the straight line as the path when he sails.
A (kx, ky) direction wind is blowing all the time, and the wind speed is a constant and is lower than the basic speed of the ¡°Black Panda¡±. The real speed ¡°Black Panda¡± produces is the vector sum of the wind-speed and the basic speed.
Now the problem is: Nono wants to know, among this N islands, what are the starting point and end point when ¡°Black Panda¡± sails fastest.
 

Input
The input has multiple cases (no more than 100). In each case, the first line contains three integers N, kx, ky, (1<N<10^5, -10^6 < kx, ky < 10^6) represent the number of islands and the direction of the wind. Following N lines, each line has two integers xi and yi (-10^6<xi, yi<10^6) represents the coordinate of the ith island. No two islands locate at the same place. Input terminates with EOF.
 

Output
For each case, output two integers x and y, separate by one space, represents when sails from x to y, ¡°Black Panda¡± reaches highest speed. If multiple solutions exist, output the one with smallest x, and if still have multiple solutions, output the one with smallest y.
 

Sample Input
3 1 1 0 0 1 1 2 3 3 1 0 0 0 -1 0 1 0 3 1 0 0 0 2 0 1 0
 

Sample Output
1 2 1 3 1 2
 

Author
temperlsyer 51isoft
 

Source
 

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