Chef And Adjacent Sums
You are given an array $A$ of size $N$. Consider an array $B$ of size $N$ formed by sorting $A$ in non-decreasing order. Let $Z = (B_N + B_{(N-1)})$. Find whether there exists any rearrangement of the array $A$, such that, for all $(1\le i \lt N)$, $(A_i + A_{(i+1)}) \lt Z$. If such a rearrangement exists, print `YES`, otherwise print `NO`. ### Input - The first line of input will contai
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