# SHIFTPAL- Editorial

OMG THAT WAS SO CUTEE!!

Its motivations like these that keep me going despite a few things <3

2 Likes

I think the problem is that you forgot to add new lines. If there are multiple test cases, all of the results are printed one after another on the same line.

yeah it isâŚ
thanks to vijjuâŚ

I am glad you liked it . It was written in a rush though XD

AhhhhâŚ Such lame thing costed me 30-40 mins of contest time
Thanks @oconnor_robert

1 Like

Good questionâŚ

1 Like

With âabaabaabaâ the answer is 3 and with âabaabaabaabaabaâ the answer is 5. Using more than three letters is also possible. With âcbabccbabccbabcâ we get 3.

2 Likes

Thank you oconnor_robert
I am terrible at coming up with test cases. How do you do it? Did you write a program to generate cases?

My first thought was âababaâ. That fails because the aâs at either end up next to each other. From that observation I realised that we need to double the other aâs. Another way to think about it is using your observation. For s = âaaaaâ we get 4. If we replace each âaâ with a palindrome, we will always get at least 4.

2 Likes

Nice work broâŚ

âabbaabbaâ is also interesting and gives 4. This is different than my other examples because there are two unique palindromes that can be formed by shifting this one: âabbaabbaâ and âbaabbaabâ.

1 Like

wow, this is amazing! Thank you again

@vijju123 nice job.

1 Like

Thank you @skyhavoc

Just to make our lives easier.

2 Likes

These factors depend strictly on your hash function. Check what the setter and tester have done, they did something different. They made it such that, instead of checking if hsh is a multiply of hsh2 or not, they simply checked for hsh1==hsh2. Give a read to editorial if they havent. Try to get what is represented by the hash function, it will be easier to understand it.

Editorial solution is expected to be put up so that we can relate with the editorial. Setter solution has been poorly explained and I couldnât get the logic behind the setterâs code.
Could you please tell me the logic behind setterâs code?

What do you mean by `"Setter solution has been poorly explained"`. What did you not understand?

I feel the concept is quite sufficiently explained and is easy to understand. Dry run a few iterations to understand.

``````Editorial solution is expected to be put up so that we can relate with the editorial.
``````

-_- . The editorial explains setterâs and testerâs solution. What do I do then, copy paste setters code?

``````Could you please tell me the logic behind setter's code?
``````

If such big editorial couldnt help you, I doubt my comment will. Please give more efforts before blaiming.

I still dont understand why do we need to conider n+1 to 3*n-1 range and make increments of 2 while counting the ans ?