King Richard's Knights

  • + 0 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