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

31085번 - Plants vs Zombies 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB111100.000%

문제

Prof. Pang is playing Plants vs Zombies.

Imagine that the game is played on a number axis. The following are the elements in the game:

  • $n$ zombies. The $i$-th zombie appears at 0ドル$ on the number axis at time $t_i$ with health point $h_i$. The zombies have the same moving speed $V$ and they all move to the right.
  • $m$ spikeweeds. The $i$-th spikeweed is of position $p_i$ and attack power $a_i$.
  • One peashooter at the position of 10ドル^{100}$. It shoots $K$ peas of attack power $D$ every second.

Every second in the game is processed as follows:

  1. When the $x$-th second begins, the zombies whose $t_i$s equal $x$ appear at position 0ドル$.
  2. After that, for each appeared and alive zombie $u,ドル it will suffer from the spikeweeds whose positions are in $(P_u, P_u + V]$ where $P_u$ is the current position of the $u$-th zombie. So its health point will be decreased by $\sum\limits_{1\le i\le m, P_u < p_i \le P_u + V} a_i$. The zombie dies if its health point is no more than zero. Otherwise, it is still alive and its position will be increased by $V$.
  3. When the $x$-th second ends, the peashooter shoots $K$ peas in a row. For each pea, it will hit the zombie that is alive and of the maximum position currently. If there are multiple zombies of the maximum position, the pea hits the one of the minimum index. The health point of the zombie being hit decreases by $D$. This zombie dies if its health point is decreased to some value no more than 0ドル$. The peas are processed one by one, not simultaneously. (For example, if a zombie is killed by the first pea, the second pea cannot hit it since it dies before the second pea is shot.) If no alive zombie exists, the remain peas will hit nothing.

Prof. Pang wants to know the death time (in seconds) of all the $n$ zombies.

입력

The first line contains five integers $n,m,V,K,D$ (1ドル\le n,m \le 10^5, 1\le V,K,D \le 10^9$) separated by single spaces.

Each of the following $n$ lines contains two integers $t_i, h_i$ (1ドル\le t_i,h_i \le 10^9$) separated by a single space.

Each of the following $m$ lines contains two integers $p_i, a_i$ (1ドル\le p_i,a_i \le 10^9$) separated by a single space.

출력

Output one line containing $n$ integers, where the $i$-th integer denotes the death time (in seconds) of the $i$-th zombie.

제한

예제 입력 1

3 2 1 2 2
1 11
2 8
1 1
1 2
2 4

예제 출력 1

2 3 1

노트

During the first second:

  • The first zombie appears and then moves to position 1. It suffers 6ドル$ damage points (2ドル$ from the first spikeweed, 4ドル$ from the two peas).
  • The third zombie appears and then moves to position 1. It suffers 2ドル$ damage points (from the first spikeweed) and dies (since its health point becomes $-1$).

During the second second:

  • The first zombie moves to position 2ドル$ and suffers 6ドル$ damage points (4ドル$ from the second spikeweed, 2ドル$ from the first pea) and dies (since its health point becomes $-1$).
  • The second zombie appears and then moves to position 1ドル$. It suffers 4ドル$ damage points (2ドル$ from the first spikeweed, 2ドル$ from the second pea).

During the third second:

  • The second zombie moves to position 2, suffers 4 damage points (4ドル$ from the second spikeweed) and dies (since its health point becomes 0ドル$).
  • The peas hit no zombie during this second.

So the death times of the zombies are 2ドル,ドル 3ドル,ドル 1ドル,ドル respectively.

출처

Contest > Open Cup > 2020/2021 Season > Stage 15, Grand Prix of China, Division 1 I번

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

출처

대학교 대회

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

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