← All problemsSign in

Grid Puzzle I

CSESAdditional Problems IIOpen on judge ↗

There is an n \times n grid, and your task is to choose from each row and column some number of squares. How can you do that? Input The first input line has an integer n: the size of the grid. The rows and columns are numbered 1,2,\dots,n. The next line has n integers a_1,a_2,\ldots,a_n: You must choose exactly a_i squares from the ith row. The las line has n integers b_1,b_2,\ldots,b_n: You m

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