I have used segement tress...and also used fast i/o then als getting TLE in java..please help me with this...I have provided the link of my code...it's algo is same as of video,

https://ide.geeksforgeeks.org/s3rB8d0ngr

look at this code I implemented at this link…and is giving TLE for test case 9 on GSS! SPOJ

Hey @kaushikjatin
Your code is as such efficient. And works perfectly within defined time limits. SPOJ has unnecessarily tight bounds sometimes. So don’t worry about that. Your segment tree array size can however be 2n+1 instead of 4n+1. This might help.

If your doubt is resolved please mark it as closed.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Bro I get you but tell me that if in future I come across such type of hard timings then also I will stuck in it…please help in this …I can best do is that use fast io but it is failing. As I code in java always then there will be a chance for this in future too…Please help in this.

@kaushikjatin
I work in C++
Maybe get in touch with a TA who works in Java on the whatsapp group
He will be better equipped to help you