now if (i < j) now you want to maximize a[i]-pref[i] for each j.
Could you please help me in understanding why maximizing (a[i]-pref[i]) will give the maximized result ?? Is there any mathematical calculation or proof of correctness ?
~TIA
now if (i < j) now you want to maximize a[i]-pref[i] for each j.
Could you please help me in understanding why maximizing (a[i]-pref[i]) will give the maximized result ?? Is there any mathematical calculation or proof of correctness ?
~TIA
I wrote a Tutorial for this Problem . Solvers who got stuck may have a look .
Here it is: IARCS AVERAGE ( Tutorial + Solution )
Not sure about the quality of Writings. But tried my best to make everything clear.
Nice Problem indeed .
Can't they update their C++ Version . ??? Could you please suggest them to add the newer version ?
Why unorder_map does not works at IARCS OPC ??
Nice BS problem . But the values of V may not be lesser than any Start[i] & values W may not be greater than End[i] . But its is sure that you can at least 1 Start[i] lesser than a value of V and 1 End[i] greater than a value of W.
Vaiya I Solved the Problem .... And I posted the thread already .
There is a problem in Subtask #1 of this problem. I tried to submit my code only for K = 1 as per problem said for Subtask #1 . But the last test case gives me WA for several . Although I thought it was my implementation error.
Later on I submitted the code for both Subtask #1 and Subtask #2 . And that solution gives me ACCEPTED.
It will be better if you change / suggest them to change the Last Test Case of Subtask#1 for the beginner who will try this problem .
~TIA