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

19470번 - Physics 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB99473845.238%

문제

There are $n$ balls on a smooth horizontal straight track. The track can be considered to be a number line. The balls can be considered to be particles with the same mass.

At the beginning, ball $i$ is at position $X_i$. It has an initial velocity of $V_i$ and is moving in direction $D_i = \pm 1$.

Additionally, a constant $C$ is given. At any moment, ball $i$ has acceleration $A_i$ and velocity $V_i,ドル they have the same direction, and magically satisfy the equation that $A_i \cdot V_i = C$.

As there are multiple balls, they may collide with each other during the movement. We suppose all collisions are perfectly elastic collisions.

There are multiple queries. Each query consists of two integers $t$ and $k$. Your task is to find out the $k$-th smallest velocity of all the balls exactly $t$ seconds after the beginning.

Note that perfectly elastic collision is defined as one in which there is no loss of kinetic energy in the collision.

입력

The first line of the input contains two integers $n$ and $C$ (1ドル \le n \le 10^5,ドル 1ドル \le C \le 10^9$).

Then $n$ lines follow. The $i$-th of them contains three integers $V_i,ドル $X_i,ドル $D_i$. $V_i$ denotes the initial velocity of ball $i$ (1ドル \le V_i \le 10^5$), $X_i$ denotes the initial position of ball $i$ (1ドル \le X_i \le 10^9$), $D_i$ denotes the direction ball $i$ moves in.

The next line contains an integer 1ドル \le q \le 10^5,ドル denoting the number of queries. After that, $q$ lines follow. Each line contains two integers 1ドル \le t \le 10^9$ and 1ドル \le k \le n$.

출력

For each query, print a single line containing the answer with absolute error at most 10ドル^{-3}$.

제한

예제 입력 1

3 7
3 3 1
3 10 -1
2 7 1
3
2 3
1 2
3 3

예제 출력 1

6.083
4.796
7.141

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 4: Ce Bin and Ryyi Ji Contest 1 F번

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

출처

대학교 대회

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

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