Stuck in a CSES Problem(Reading Books)

Problem - Click Here

I am not able to get AC in this. I am getting WA on 3 test cases.
So i landed on a github solution in which i can’t understand why that solution works.

A Github Solution - Click Here

I didn’t understood when (m <= (s - m) ) print s , i understood the rest of code but not getting why this line gets to AC.

Can anyone explain it or if you have your own approach you are most welcome.
Thanks in Advance!

Anybody Please help!

Can Anyone Help Please.I am Stuck!

Come up with an “optimal strategy” for them to read books to minimize the time

1 Like

@galencolin This is the question not the

Can you please elaborate on optimal strategy.@galencolin

Well, you submitted something and got a wrong answer, what is your solution?

1 Like

I assume by “elaborate” you mean “spoonfeed”

1 Like

Bro i have already done much thinking and paperwork thats why i asked.

My Solution getting WA on 3 test cases-Click Here
Kind of Two Pointer Approach.

If you insist. The optimal strategy is to have the first person start from the shortest book and read in ascending order and have the second person start from the longest book, then go to the shortest book and read in ascending order.

1 Like

this is what i am doing i think

this should be descending order.Right?


I will see to it Thanks