Dragon ques of long challenge

I tried this question for 10pts and my first approach was this. I tested this on multiple test cases and was getting correct answer but this code did not pass all test cases for subtask one .Can anyone help
This is my submission link

https://www.codechef.com/viewsolution/35476517

Check on these tests:

1 Like

Shouldn’t query 2 5 5 give answer : 7 ?

since the 5th den has tastiness value = 7 …But your output file says : 9
I see the same with other queries having Pb == Pc

What am I missing?

The value of 5th den was updated to 9 in a particular query.

According to line #43 of input file, the tastiness of 5th den should be updated to 9

1 Like

Don’t know how I missed that! Thanks

:+1: :+1:

Hi @c2h5sh

I tried your test cases and my code (logic from the editorial) passes all but 1 file in the 3rd subtask which gives TLE. Can you help me find out why?

My Java solution

Not sure about it bro, I’m not so familiar with Java :confused:

1 Like

Ok, thanks anyway :slight_smile: