http://mirror.codeforces.com/problemset/problem/7/D
Can someone please explain to me the problem ? I don't understand how the result was 6 for the second input case.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
http://mirror.codeforces.com/problemset/problem/7/D
Can someone please explain to me the problem ? I don't understand how the result was 6 for the second input case.
Name |
---|
Well, the problem says: "Output the only number — the sum of the polindrome degrees of all the string's prefixes."
So if you get the degree for every prefix you get the following:
"a" — 1; "ab" — 0; "aba" — 2; "abac" — 0; "abaca" — 0; "abacab" — 0; "abacaba" — 3;
So, the sum of all degrees is 6.
Thank you, I got AC now :) Didn't quite understand how to calculate the value for each prefix at first.
why "ab" has palindrome degree of 0 I mean , [n/2] prefix = "a" -> 1 [n/2] suffix = "b" -> 1
Please help me to understand the problem ???
UPD : I missed The line It should be a palindrome ..
actually I didn't get how to calculate palindrome degrees?
explanation of second input case as hriss95 said
BTW, I found some solutions which got AC but it gives WA on some test due to bad hashing
for example this submission 3686936 which is the first submission on status list
fails on test:
aobd
Thanks for your reply. I got AC using the Z-Algorithm, by concatenating the string with its reverse, didn't use rabin karp hashing. My submission is 4207962.
When I saw this, I thought: "7-dimensional Palindrome Degree? :O"