18 and above
CodeChefOpen on judge ↗
Priyanka and Palash are the only two candidates competing in a certain election. We know from polls that exactly N voters support Priyanka, and exactly M voters support Palash. We also know that N is greater than M, so Priyanka will win. Voters will show up at the polling place one at a time, in an order chosen uniformly at random from all possible (N + M)! orders. After each voter casts their vo
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