← All problemsSign in

Rectangular Queries

CodeChefRating 1778Open on judge ↗

You are given a square matrix $A$ of size $N \times N$ (having $N$ rows and $N$ columns). **The values in the matrix are integers restricted to a small range, specifically $1 \le A_{i, j} \le 10$.** Your task is to answer exactly $Q$ queries, where each query defines a rectangular submatrix. The submatrix is specified by its upper-left corner $(X_1, Y_1)$ and its lower-right corner $(X_2, Y_2

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