Something wrong with this dp formulation?

Правка en2, от ycperson, 2024-11-28 05:27:49

I encountered some strange difficulty with this problem: https://codeforces.me/contest/1714/problem/D. The dp idea is that dp[i] represents the answer for the problem for prefix up to position i. dp[i] takes the longest string with an occurrence ending at position i and then checks the dp answer for all positions within the string occurrence and then the position to the left of the beginning of the string occurrence (quite similar to the tutorial solution). However, I am getting wrong answer on test case 9 still. I don't know quite why...

Could someone take a look at this submission to see what is wrong? https://codeforces.me/contest/1714/submission/293576606 (scroll to bottom for actual code, above is template stuff)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский ycperson 2024-11-28 05:28:41 14 Tiny change: 'ccurrence and then ' -> 'ccurrence (except at i) and then '
en2 Английский ycperson 2024-11-28 05:27:49 23 Tiny change: 'test/1714/submission/293576606. The dp i' -> 'test/1714/problem/D. The dp i'
en1 Английский ycperson 2024-11-28 05:27:25 785 Initial revision (published)