QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22334. Ô tô của bò

Statistics

$N$ $(1 \le N \le 50,000)$ bò số $1,\ldots,N$ lái xe riêng trên cao tốc Cowtopia. Bò $i$ chọn bất kỳ $M$ làn $(1 \le M \le N)$, tối đa $S_{i}$ $(1 \le S_{i} \le 1,000,000)$ km/giờ.

Sau trải nghiệm lái tệ, chúng ghét va chạm và rất cố tránh. Mỗi bò phía trước trên đường khiến $i$ giảm $D$ $(0 \le D \le 5,000)$ km/giờ, không dưới $0$. Có $K$ phía trước thì $\max(S_i - D K, 0)$. Dù nhanh hơn con ngay trước, khoảng cách đủ lớn nên sau giảm không đâm.

Cowtopia yêu cầu ít nhất $L$ $(1 \le L \le 1,000,000)$ km/giờ, nên vài bò không thể đi theo luật này. Tìm số tối đa tuân luật tối thiểu.

Dữ liệu vào

  • Dòng $1$: số nguyên $N$, $M$, $D$, $L$ cách nhau bằng dấu cách.

  • Dòng $2,\ldots,N+1$: dòng $i+1$ tả tốc độ đầu của $i$ bằng số nguyên $S_{i}$.

Dữ liệu ra

  • Dòng $1$: số nguyên, số bò tối đa trên cao tốc.

Ví dụ

Dữ liệu vào 1

3 1 1 5
5
7
5

Dữ liệu ra 1

2

Ghi chú

Ba bò, một làn, giảm $1$, tối thiểu $5$.

Hai con được: bất kỳ con tốc độ $5$ trước, con $7$ thứ hai.

Tác giả bài toán: Neal Wu, 2007

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.