[CodeChef: Practical coding for everyone]

How to get rid of tle??

You need to create a more optimal solution for this problem.

Instead of accessing all the values for the wormholes you need to find the most appropriate one using Binary Search

Take one exam timing at a time and find out using binary search which timings of wormholes will give the most optimal result

https://www.codechef.com/LRNDSA02/status/ZCO12002,mohsina123

I have optimised it and got subtask 1 accepted.Not able to further optimise it.

I am not getting idea on how to apply binary search for this

Read about `upper_bound()`

in `C++`

and why are you using `find()`

, read its documentation its complexity is O(n) and man first calculate the time complexity of your code then you will get ideas on where to optimize to make your solution better.