I do this task 536B - Tavas and Malekas and I have two solutions ( with hashing and z-function ), but I saw one strange solution with dp.I think that isn't good, but also I don't understand how this solution passed all samples 10723410 ?
Exapmle:
7 2 ababb 1 3
Answer should be 0 , but this code gave result 1.
Instead of looking for matching between two adjacent occurrences, this solution just comparing first two characters which is obviously wrong. DP named array is holding prefix summations and I would not call it as "dp".
Thanks for reply! I thought I might be mad , and don't understand solution :D
I appreciate the effort made to create competition, but this things shouldn't occur.In this solution the main problem the task isn't done, that isn't some corner case.