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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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"