← All problemsSign in

Play with Numbers

Ramneek has some numbers with her. She loves to play with numbers. She uses two arrays A and B to arrange the numbers. In array A she keeps some elements,let it be, A1,A2...AN. And in array B she keeps some other elements, let it be, B1,B2...BN. There is a relationship between Ai and Bi, ∀ 1 ≤ i ≤ N, i.e., any element Ai lies between 1 and Bi. Let the cost S of an array A be defined as: S = Σ

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