← All problemsSign in

Adding Squares

There are $N$ different vertical lines on the plane, $i$-th of which is defined by the equation $x=a_i$ ($0 \le a_i \le W$) and $M$ different horizontal lines, $i$-th of which is defined by the equation $y=b_i$ ($0 \le b_i \le H$). You must add one line of the form $y=k$ ($0 \le k \le H$, $k \neq b_i$ for every $1 \le i \le M$) to the plane. What is the maximum possible number of squares with diff

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