Hi.
I'm trying to solve this problem from Live Archive Link.
I'm receiving Wrong Answer and the test data isn't available online. To briefly explain my solution, I pre-process the hashing function for the whole string, and them take the hash of the slices I want from this array and apply it's inverse module to normalize the prime powers. Is there something wrong with this approach ?
Thanks in advance.
Here's my AC solution: http://ideone.com/6AVLRk
You can generate random inputs and compare with your output.
What's actually happening in lines 13 and 14. I've never seen such a hashing strategy, could you explain more about it or give some sources about this technique ?
Actually same as usual hashing. And since we look for palindrome, just find whether prefix and suffix match or not
Here's the official editorial : link
I got the idea of prefix and suffix hashing, but I still got the idea on how this code works. Even in the editorial it isn't clear. Do you have more information on 'suffix hash' calculation ?
Line 13 — Forward hashing (left to right).
Line 14 — Reverse hashing (right to left).
Think about how you can convert the string "1234" in base 10 to integer, traversing from left to right and from right to left.
By the way, I submitted this solution for test purposes and it returns a WA.
I believe there is some problem with Live Archive. https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=19 does not look normal
I've been struck in Live Archive for 2 days in 2 problems. They know how to drive a coder crazy.
What do you mean? I just got that Accepted again.
http://acm.hust.edu.cn/vjudge/problem/viewSource.action?id=2893336
My solutions were also accepted. Live Archive had a bug or something and was judgind any solution as wrong answer. They know how drive me crazy.