QOJ.ac

QOJ

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

#22673. Romeo incontra Juliet

Statistics

Le mandrie Moontagues e Cowpulets di Farmer John sono nemiche. Il toro Romeo, Moontague, ama Juliet, Cowpulet, e vuole incontrarla senza che gli altri Cowpulets sappiano.

Vogliono incontrarsi e pascolare nella regione più grande lungo il recinto, senza troppi Cowpulets per non essere scoperti. Romeo conosce i posti dei $N$ Cowpulets ($1 \le N \le 1000$). Il lungo recinto diritto ha $P$ pali equidistanti ($1 \le P \le 1000$), numeri $1\ldots P$; ognuno tra adiacenti. Trova la regione contigua più lunga con al massimo $C$ ($0 \le C \le 1000$) Cowpulets.

Input

  • Riga $1$: tre interi separati $N$, $P$, $C$.

  • Righe $2\ldots N+1$: intero $X$ ($1\ldots P-1$), mucca tra $X$ e $X+1$. Più mucche possono stare tra la stessa coppia.

Output

  • Riga $1$: intero, numero di spazi della regione contigua più grande con al massimo $C$ Cowpulets.

Esempi

Input 1

2 6 1
2
3

Output 1

3

Spiegazione

Sei pali $1,2,3,4,5,6$; due Cowpulets tra $2$, $3$ e tra $3$, $4$.

Tra $3$ e $6$, lunghezza $3$, c’è solo un Cowpulet.

Problema 8: Romeo incontra Juliet [???, 26/0]

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.