Elections in Chefland
CodeChefOpen on judge ↗
There is going to be an election in Chefland between Alice and Bob. In an election, all voters stand in a queue and vote one by one. Voter at position $i$ in the queue votes at the beginning of $i$-th minute. After the results were declared, Alice got $A$ votes and Bob got $B$ votes. Thus, the voting happens for $A+B$ minutes. Chef, being an statistician, decided to play with election results. He
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