Buying Game
You want to buy $N$ items from a store, which you will visit on Days $1$, $2$, ..., $N$. The normal cost of the $i$-th item is $A_i$. However, on the $i$-th day, there is a promotional event for the $i$-th item. On this day, it's cost is $B_i$ instead. $B_i$ may be greater, smaller or even equal to $A_i$. Thus, on the $i$-th day, the cost of the $i$-th item is $B_i$ while, the $j$-th item $(j \
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