I have known about an O(n log^2 n) solution, it can deal with the general case where l[i] and r[i] are in range [0, n].
However, it got TLE on test 2.
I think it’s because this problem have the special constraint on l[i] and r[i] (we have l[i] = 0, r[i] = 1 for all i), with which we can make some further observations to optimize the general solution.
Looking forward to your reply.
Suggested Topics
Topic | Category | Replies | Views | Activity |
---|---|---|---|---|
ADV04F - Four Chips(hard) HELP! | ProblemSet Archive | 1 | 57 | 21d |
What are allowed characters in task t9 | ProblemSet Archive | 4 | 218 | Feb 24 |
Help me please! | ProblemSet Archive | 4 | 28 | 12d |
Getting TLE in AKBAR - Akbar , The great. Why? | ProblemSet Archive | 3 | 194 | Mar 11 |
COT - Count on a tree - TLE | ProblemSet Archive | 1 | 134 | Mar 18 |