← All problemsSign in

Sagar and Conundrum

Problem Statement Sagar wants to sell his goods to M customers (say C1,C2....CM) and he has N suppliers(say S1,S2,...SN). While selling goods from Si to Ci his overall profit depends on Ci and Si. But there is a pattern in which he likes to sell his goods. If he is selling goods from Si he can sell it to C1,C2..CM but once he starts taking goods from Si+1, he cannot sell goods from Si.Similarly,

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