We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
if you're solving this problem in O(N^2), you're not even close. You can solve this problem in O(L*S), but that's still not fast enough, not even for a single test case (except sample). Honestly I just gave up and looked up the editorial. You have to do binary search somewhere. sigh
King Richard's Knights
You are viewing a single comment's thread. Return to all comments →
if you're solving this problem in O(N^2), you're not even close. You can solve this problem in O(L*S), but that's still not fast enough, not even for a single test case (except sample). Honestly I just gave up and looked up the editorial. You have to do binary search somewhere. sigh