Блог пользователя lucas1809

Автор lucas1809, 4 года назад, По-английски

I was trying to solve round 656, question D (div3), and thought my logic in question D was right, but It's giving a wrong exit code in test case 3, causing TLE

https://codeforces.com/contest/1385/submission/87354850 <- code

My logic was using dp to find the minimum route of moves necessary. I use the function "contar" to count the number of moves necessary for the left part of the string and the right part, and recursevely use "solve" to get the best answer.

Also, is there a way to copy and paste the test cases used on the judge? I can't test -test case 3-, because It's too long, which is frustrating.

Thanks in advance. I would really apreciate it if you could help me

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Your recursive function copies a whole string in every call, and comlexity is being O(N^2).

Just add a reference to it like string &s

UPD: AC

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I think there is no such feature as copy or download the testcases on codeforces but I hope it will be added soon. :)