vivek034's blog

By vivek034, history, 22 months ago, In English

Could some one help me for finding the error in my submission :-(https://codeforces.com/contest/1092/submission/47307889). Thanks! :)

 
 
 
 
  • Vote: I like it
  • -4
  • Vote: I do not like it

»
22 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Auto comment: topic has been updated by vivek034 (previous revision, new revision, compare).

»
22 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Check this slight update to your code.

47347385

Your code should have the if-condition (i > 0 and p[i] == q[i-1]) to avoid accessing q[-1] when i = 0. The updated code did not pass test case 19 as it computed the n-letter string to be "babab" whereas the correct string should be "ababa", as both prefix and suffix of length 1 are "a".

You may check the the following solution as well as the tutorial for hints on how the correct string is computed.

47236313

»
22 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

gaurav172 You must see this code. It must be little familiar to you. #chandela xD