Logo
(追記) (追記ここまで)

20634번 - Zombie Land 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 512 MB152220.000%

문제

Your friend, Tatsumi, is a producer of Immortal Culture Production in Chiba (ICPC). His company is planning to form a zombie rock band named Gray Faces and cheer Chiba Prefecture up.

But, unfortunately, there is only one zombie in ICPC. So, Tatsumi decided to release the zombie on a platform of Soga station to produce a sufficient number of zombies. As you may know, a zombie changes a human into a new zombie by passing by the human. In other words, a human becomes a zombie when the human and a zombie are at the same point. Note that a zombie who used to be a human changes a human into a zombie too.

The platform of Soga station is represented by an infinitely long line, and Tatsumi will release a zombie at a point with coordinate $x_Z$. After the release, the zombie will start walking in the positive direction at $v_Z$ per second. If $v_Z$ is negative, the zombie will walk in the negative direction at $|v_Z|$ per second.

There are $N$ humans on the platform. When Tatsumi releases the zombie, the $i$-th human will be at a point with coordinate $xi$ and will start walking in the positive direction at $vi$ per second. If $v_i$ is negative, the human will walk in the negative direction at $|vi|$ per second as well as the zombie.

For each human on the platform, Tatsumi wants to know when the human becomes a zombie. Please help him by writing a program that calculates a time when each human on the platform becomes a zombie.

입력

The first line of the input consists of an integer $N$ (1ドル \le N \le 2 \cdot 10^5$) which is the number of humans on a platform of Soga station. The second line consists of two integers $x_Z$ ($-10^9 \le x_Z \le 10^9$) and $v_Z$($-10^9 \le v_Z \le 10^9$) separated by a space, where $x_Z$ is an initial position of a zombie Tatsumi will release and $v_Z$ is the velocity of the zombie.

The $i$-th line in the following $N$ lines contains two integers $x_i$ ($-10^9 \le x_i \le 10^9$) and $v_i$ ($-10^9 \le v_i \le 10^9$) separated by a space, where the $x_i$ is an initial position of the $i$-th human and $v_i$ is the velocity of the human. There is no human that shares their initial position with the zombie. In addition, initial positions of the humans are different from each other.

출력

Print $N$ lines. In the $i$-th line, print how many seconds it will take for the $i$-th human to become a zombie. If the $i$-th human will never become a zombie, print $−1$ instead. The answer will be considered as correct if the values output have an absolute or relative error less than 10ドル^{-9}$.

제한

예제 입력 1

6
3 1
-5 0
5 0
-4 -3
0 -2
6 -3
2 -1

예제 출력 1

3.66666666666667
2.00000000000000
-1
6.00000000000000
0.75000000000000
2.00000000000000

예제 입력 2

5
31415 -926
5358 979
323846 26
-433832 7950
288 -4
-1971 -69

예제 출력 2

13.67821522309711
95.61812216052499
52.41629112212708
33.76030368763558
38.95682613768962

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2020 > Day 5: JAG Summer+ Opening Contest I번

Contest > ICPC Japanese Alumni Group > JAG Summer Camp > JAG Summer Camp 2019 Day 1 I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /