Counting Lights
CodeChefOpen on judge ↗
Fluffy the Squirrel has an m times n grid of lights, where some of them are turned on. He thinks a subrectangle of the grid is called beautiful if the number of lights that are on in the subrectangle is between l and r inclusive. He wonders how many beautiful subrectangles of the grid exist. Can you help him with this task? Input The first line of input contains two integers, m and n, denoting
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