大神级的问题!
I have a file of list of integer tuples (one per line) could be pretty long (could have around 1 million lines), input format in this way, for example:
30 40
3 100
34 900
200 1000
24 9000
4000 20000
3000 8000
30000 30040
(The integer tuple means line segment on the X axis, all positives, first number is always less than 2nd number. Eg: 30 40 means a line segment with length of 50.)
Write a python program:
Please Write a python program, print out all pairs of segments that overlaps with each other. For example: [40 200] overlaps with [10 90], and overlaps with [140 500], but not with [400 500] or [10 20], we define that [10 20] does not overlap with [20 40])