Submit | All submissions | Best solutions | Back to list |
PALIM - Yet Another Longest Palindrome Problem |
A string is called a palindrome if it's the same when read from left to right and from right to left. For example, "abdba" is a palindrome, but "abbaa" is not.
Given a string, print the length of the longest consecutive sequence of characters occurring at least once in this string, which is a palindrome.
Input
- Line 1: a string consists of at most 100000 characters. The ASCII code of all characters are between 32 and 127, inclusive.
- Line 2: a magical key(for security purpose).
Output
- Line 1: the length of the longest palindrome.
- Line 2: the magical key.
Example
Input: abaabbabaaba MAGICAL KEY Output: 6 MAGICAL KEY
Restriction
Only C++ is allowed in this problem now. In addition, you will receive "wrong answer" if your program don't start with this. You can't use macro "#undef" in your solution as well.
If you want to solve this problem in another language, send me the header file in your language please.
warning: Don't try to access the memory of tester, or I will reject your solution manually, and you will lose the chance to enjoy this problem as well.
Hint
hint of using tester library: you can't read anything from stdin, and you can't print anything as well, your program will be terminated if you called answer().
hint of viewing feedback: You can click on "wrong answer" link to view the feedback of judge: whether your solution didn't include the testlib, or failed on sample. (if neither, your solution failed on a further test case)
Notice
update on Oct.24: I had updated the header file for C++, now you will receive "Runtime Error(NZEC)" if your solution called isSame() illegally. The submissions with old version of header file are still acceptable.
rejudge on Oct.24: some test cases were added, three submissions were rejudged as TLE instead of AC.
Added by: | Bin Jin |
Date: | 2008-10-23 |
Time limit: | 1s |
Source limit: | 10240B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C++ 4.3.2 CPP |
Resource: | the (second??) "interactive" problem on SPOJ |
hide comments
2019-06-20 14:40:09 cegprakash
Copy pasting the tester code on Visual Studio was auto correcting spacings and tabs. But copy pasting on wordpad gave AC. Pranet verma : The library exposes 3 functions. Just use them. Do not use cin or cout. The library code should be in the top of ur solution. Last edit: 2019-06-20 14:43:27 |
|
2013-05-27 21:01:40 Pranet Verma
what exactly are we supposed to do with the tester library? can we make changes to it ? and where do we store the answer? |
|
2013-04-30 17:40:01 lovelotus
Can you please tell why it says "Your solution don't match the header file", even when when i have followed the instructions and it works well on my system... id 9184095 :( |
|
2012-09-23 20:33:11 :D
RE nhs: did you paste the header given in description? This is a very interesting take on enforcing optimal solutions. Great alternative for relying on troublesome time limits that often break because break because of input reading, language differences and overall poor precision. The problem of language barrier still remains and it requires some "hacks", but still a great idea. |
|
2012-08-03 09:10:43 nhs
"Your solution don't match the header file". I am not getting what I am supposed to do for this. Please check, my submission id : 7409465 |
|
2011-06-09 18:45:36 যোবায়ের
"Your solution don't match the header file" but I just copied and pasted the testlib header before my code. I can't understand :-? submission ID 3551548 [edit] It was actually not my fault, when I copied the text, it caused some problem I guess, but when I sent the file, it was ok. Thanks for your nice problem, I've learnt something new. [/edit] Last edit: 2010-04-24 13:13:00 |
|
2011-06-09 18:45:36 [Trichromatic] XilinX
After solving this problem you can try problem PALDR. |