← All problemsSign in

Riku and Toys

In Quartzland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109 . A toy from the new collection of the i­th type costs i quartz. Riku has managed to collect N different types of toys A1 , A2... AN from the new collection. Today is Riku's birthday, and her mother decided to spend no more than M quartz on the gift

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