Society Control
CodeChefOpen on judge ↗
There is a long street having $N$ buildings in a row, located on one side of the street, numbered sequentially from 0 to n − 1. Each building i has Fi flats in it. The buildings want to join together and form a society. To form a society a restriction imposed is that buildings in a society must occur consecutively along the street i.e one after the other. In a society, the building that has more
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