Happiness Level
CodeChefOpen on judge ↗
All array notations are 1-based indexing. There are N cities in a Country. Cities are numbered from 1 to N from west to east (like a 1 indexed array). Distance between city i and city i + 1 is A[i]. Rohit is on a tour in this country and wants to buy ancient articles found in this country.There are M ancient articles found in this country. Every city has all the M articles. Rohit wants to have all
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