← All problemsSign in

Subset Min Max

CodeChefRating 1983Open on judge ↗

For an array $A$ of length $N$ and a binary string $S$ of length $N$, define $f(S)$ as follows: * Create an array $B$ containing exactly those values $A_i$ such that $S_i = 1$. * If $B$ is empty, $f(S) = 0$. * Otherwise, $f(S) = \min(B) \cdot \max(B)$ --- You are given an array $A$ of length $N$, a binary string $S$ of length $N$, and a positive integer $X$. In one operation, you may toggle any

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