allllekssssa's blog

By allllekssssa, 9 years ago, In English

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.

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it +5 Vote: I do not like it

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".

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.