QOJ.ac

QOJ

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

#22398. Ah, essas modas

Statistics

Como outros adolescentes, vacas jovens às vezes seguem modas: arco de hula, pedra de estimação, Counterstrike, Pokemon, Rick Astley ou tatuagens tribais nos úberes.

Matematicamente, a atratividade inicial é $L$ ($1 \le L \le 50,000$). A resistência da vaca $i$ ($0 \le R_{i} \le 1,000,000$) indica quanto tempo evita a moda antes de não ter alternativa. Se a atratividade atinge ou supera a resistência, quer participar.

Cada participante aumenta a atratividade em $K$ ($1 \le K \le 2,500$) por pressão dos pares.

Dadas $N$ ($1 \le N \le 100,000$) vacas, determine quantas participam.

Entrada

  • Linha $1$: inteiros $N$, $L$, $K$ separados por espaços.

  • Linhas $2..N+1$: linha $i+1$, resistência da vaca $i$, inteiro $R_{i}$.

Saída

  • Linha $1$: inteiro, participantes finais.

Exemplos

Entrada 1

5 2 3
2
6
12
5
14

Saída 1

3

Nota

Cinco resistências $2,6,12,5,14$, atratividade inicial $2$; cada participante soma $3$ ao índice.

$2$ atrai vaca nº$1$ (resistência $2$) e sobe a $5$; nº$4$ ($5$) sobe a $8$; nº$2$ ($6$) a $11$. Nem nº$3$ ($12$) nem nº$5$ ($14$) adere; total $3$.

Autor do problema: Jarrah Lacko, 2009

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.