Language selection
Firstly, you will probably never pass the grader if you use python. If you look at the status of all past decisions here, http://www.spoj.com/status/GSS1/start=0 , you will see that almost every decision made is written in C ++. I don't think you have a choice but to use C ++. Please note how long is 0.115s-0.230s. This is a C / C ++ only restriction. For problems that will be made in other languages, the time limit will be a round number, for example, 1 second. Python is about 2-4 times slower than C ++ in this type of environment.
Segment tree implementation problems ...?
Secondly, I'm not sure if your code really creates a tree of segments. In particular, I do not understand why this line is:
t[v]=min(t[2*v],t[2*v+1])
I am sure that the node in the segment tree stores the sum of its children, so if your implementation is close to correct, I think that it should read instead
t[v] = t[2*v] + t[2*v+1]
If your code is βcorrect,β I asked how you find the maximum interval amount in the range [x_i, y_i] if you do not even store the sum of the intervals.
Iterative Segment Tree
Third, the segment tree can be implemented iteratively. Here is the C ++ tutorial: http://codeforces.com/blog/entry/18051 .
The segment tree doesn't have to be fast enough for this ...
Finally, I donβt understand how the segment tree will help you solve this problem. The segment tree allows you to query the sum of the range in log(n) . This problem requires the maximum possible amount of any range. I have not heard of a segment tree that allows a "minimum range request" or "maximum range request."
The naive solution would be O (n ^ 3) (try all n ^ 2 possible start and end points and calculate the sum in O (n) operations) for 1 query. And, if you use a segment tree, you can get the sum in O (log (n)) instead of O (n). This will only speed you up to O (n ^ 2 log (n)), which cannot work for N = 50,000.
Alternative algorithm
I think you should look at this instead, which is done in O (n) for each request: http://www.geeksforgeeks.org/largest-sum-contiguous-subarray/ . Write it in C / C ++ and be efficient with IO, as one commenter suggested.