← All problemsSign in

Yet another expected value problem

You are given a matrix $A$ having $N$ rows and $M$ columns. You are also given an integer $K$. Initially all rows and columns are unprocessed. You initialize a variable `ans` to be $0$. You do the following experiment until all rows and columns have been processed: - From the list of unprocessed rows and columns, choose one uniformly at random. Let the sum of this selected row/column be $S$. Add

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