Good Rectangles
CodeChefOpen on judge ↗
You are given a grid of size M x N, where each square is colored with some random color among K colors with each having equal probability. A Good Rectangle is defined as one where all squares lying on the inner border are of the same color. What is the expected number of Good Rectangles in the given grid. Input - First Line contains M, N, K Output A single value rounded off to the nearest
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