this problem isn't seems hard ...
but in fact I can't figure out how to solve it excepted for brute force, which directly cause me getting TLE
![:o](./images/smilies/icon_eek.gif)
I know
Code: Select all
for any two ONE-TIME task, we can use O(n^2) brute force to check whether they are intersect with each other
for a ONE-TIME task and a REPEAT task , we can use O(n*m) brute force to check whether they are intersect with each other, using format
ONE-TIME = [a1, b1 ]
REPEAT = [a2 + k*REP, b2+k*REP]
if there exist a valid k, b2+k*REP >=a1 && a2+k*REP<=b1 , they are intersect
I can't figure out any format or have another ideas...
anyone gives me some hints plz....
Thx in advance
![:wink:](./images/smilies/icon_wink.gif)