Max power of sage
CodeChefOpen on judge ↗
Sage has two weapons p and q. She has an array A of attacks. She wants to choose two indices i and j (1<=i<=j and j<=n) such that her power p*A[i]+q*A[j] is maximum. ###Input:- First line contains three integers n,p and q(1<=n<=10^5 and -10^9<=p,q<=10^9). Second line contains n integers i.e the array of attacks (-10^9<=A[i]<=10^9). ###Output:- Maximum possible value for p*A[i]+q*
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