Naruto and Rectangles
CodeChefOpen on judge ↗
Given $n$ non-negative integers $a_1, a_2, ..., a_n$ , where each represents a point at coordinate $(i, ai)$. $n$ vertical lines are drawn such that the two endpoints of the line $i$ is at$ (i, ai)$ and $(i, 0)$. Naruto wants to draw a rectangle using these lines. The base should be the x-axis, while the two sides should be any two lines from the above-given lines. The other lines will magical
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