Margen
CodeChefOpen on judge ↗
Considere un conjunto de $N$ enteros $S=\{a_1, \ldots, a_N\}$. Un *margen* es un entero no-negativo $L$ tal que es posible escoger $N$ enteros $x_1, \ldots, x_N$ tal que para todo $i$, $1\leq i \leq N$, el intervalo $[x_i, x_i+L]$ contiene al menos $K$ de los enteros en $S$, incluido $a_i$. Calcule el mínimo margen possible para un $K$ dado. ###Entrada: La entrada contiene: - En la línea 1, los
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start