← All problemsSign in

You have N soldiers at your disposal , each having certain strength.Your senior commander is asking some questions.His questions are of the form , given strength S and a number K , do there exist K different soldiers such that sum of their strengths is S. Input First line of input contains N and Q.Number of soldiers and the number of queries asked by head commander.Then N lines follow describing

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