ash_vs_ash's blog

By ash_vs_ash, history, 4 years ago, In English

I am continuously getting TLE on "substring search" (question 1 of step 3 ). I tried declaring global variables, tried passing reference to vectors, reduced function calls but nothing worked. According to me, my code is O(nlogn). Can someone please help me in finding why I am getting TLE. Here is the code: https://codeforces.com/edu/course/2/lesson/2/3/practice/contest/269118/submission/85793528

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By ash_vs_ash, history, 5 years ago, In English

I was trying to solve this problem on Codechef, " https://www.codechef.com/ICOP1904/problems/GRP ". I understand that I have to use DP to solve it and also that I have to maintain two states, but I am unable to figure out how to proceed to solve it. I even looked at some submissions but I am still not sure if I got it completely. Can someone please explain me how to solve the problem. Thanks in advance..

Full text and comments »

Tags #dp
  • Vote: I like it
  • -18
  • Vote: I do not like it