← All problemsSign in

Sets Diff by K

CodeChefRating 1474Open on judge ↗

For a permutation $P$ and a integer $K$, we define $f(P, K)$ as the set $S$ formed by the following process: - Initially, let $S$ be an empty set. - For each $i = 1, 2, \ldots, N$: - Check if there exists $x \in S$ such that $|x - P_i| \le K$. - Append $P_i$ to $S$ if and only if there does not exist such $x$. ---- You are given a set $S$ of elements, represented by a binary array $B$

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start