Problem — https://codeforces.net/problemset/problem/1863/E↵
↵
Submission — https://codeforces.net/contest/1863/submission/22141296339998716↵
↵
↵
I created a graph of the dependencies. Then for each index, I am storing the the starting hour of that index, and the number of hours I need to complete all tasks that need to be done after it. I even did the same after computing topo sort first and then doing this, but that also gave tle.↵
↵
According to me I am performing simple dfs and traversing each node only once, so the solution should work. Cannot really figure out why it gives tle.↵
↵
Your help will be appreciated.↵
↵
↵
Update — The Submission link
↵
Submission — https://codeforces.net/contest/1863/submission/2
↵
↵
I created a graph of the dependencies. Then for each index, I am storing the the starting hour of that index, and the number of hours I need to complete all tasks that need to be done after it. I even did the same after computing topo sort first and then doing this, but that also gave tle.↵
↵
According to me I am performing simple dfs and traversing each node only once, so the solution should work. Cannot really figure out why it gives tle.↵
↵
Your help will be appreciated.↵
↵
↵
Update — The Submission link