Closed GaurangTandon closed 4 years ago
Did you have the $ placed at the end? It's unlikely there is an error, can you point me to a CodeForces submission where you have that error? The code you have linked is not what we are using now, right, nor the one you have changed it to?
Sure.
Unchanged code.. The output is:
6 $
5 a$
3 aba$
1 ababa$
4 ba$
0 bababa$
2 baba$
whereas changed code gives the correct output:
6 $
5 a$
3 aba$
1 ababa$
4 ba$
2 baba$
0 bababa$
If you want, can we just tag anurudhp here so that he knows of this bug? (afair you said we are using a template similar to his)
This code failed on input string
bababa
, as the number of iterations performed was ONE short of what were required to produce the correct result. Normally, I would fix this by using awhile (true)
loop and checking ifrank == n
, see example here, but in this case, the size of the matrix was hardcoded to [logn][n] so just increasing logn was sufficient.