Queries Are Fun
CodeChefOpen on judge ↗
Let $d(C)$ denote the number of **distinct** elements in array $C$. For a given array $B$ of length $M$, $\text{score}(B) = \max(d(C))$ across all $C$ satisfying: - $C$ consists of $M$ positive integers; - $1\le C_i \le B_i$ for all $1\le i \le M$; - $C$ is a **non-decreasing** array. You are given an array $A$ of size $N$ and $Q$ queries. For the $i^{th}$ query: - Given two integers $P_i$ and
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