Page 3 of 4
Re: 11221 - Magic square palindromes
Posted: Thu Aug 30, 2012 3:24 pm
by mmfrb
Why do I keep getting RE? Some1 help please!
Re: 11221 - Magic square palindromes
Posted: Thu Aug 30, 2012 8:35 pm
by brianfry713
A line is up to 9,999 characters long.
Re: 11221 - Magic square palindromes
Posted: Thu Aug 30, 2012 10:51 pm
by mmfrb
Wow, I did not expect that kind of mistake... but i didn't have any idea a line could reach this size, now I got AC. Thank you very much!

Re: 11221 - Magic square palindromes
Posted: Fri Aug 31, 2012 7:31 pm
by brianfry713
It's in the problem statement.
Re: 11221 - Magic square palindromes
Posted: Sat Oct 06, 2012 7:36 pm
by macbon
Problem statement is wrong. Maximum line length is 10000 not 9999!
Re: 11221 - Magic square palindromes
Posted: Sat Nov 03, 2012 6:48 pm
by gdisastery
Input:
Code: Select all
2
:) ~ :D ~~~~ :))))))) :D :D :D
:P :P :P :P
AC Output:
Re: 11221 - Magic square palindromes
Posted: Sat Jun 15, 2013 6:14 pm
by kirasan
Someone can explain me why checking if it is palindrome is enough?
What happens if I have this sentence
"Sator mrepo tenet operm rotas"
Clearly it's palindrome, but reading up-bottom it's not the same as the original sentence.
Re: 11221 - Magic square palindromes
Posted: Tue Jun 18, 2013 1:22 am
by brianfry713
Your input produces output:
Case #1:
No magic
It is not enough just to check if it's a palindrome.
A magic square palindrome is a sentence whose characters can be divided in a K × K square table with the property that the original sentence can be read from the table in four different ways:
Start from the (1,1) cell, move right until the end of the line and than proceed to the next line.
Start from the (1,1) cell, move down until the end of the column and then proceed to the next column.
Start from the (K,K) cell, move left until the beginning of the line and then proceed to the previous line.
Start from the (K,K) cell, move up until the beginning of the column and then proceed to the previous column.
Re: 11221 - Magic square palindromes
Posted: Wed Jun 19, 2013 10:09 am
by thomp
No, I think kirasan is right. I spent far too long on this problem (you can see in the uHunt submission history) only to find that you get WA if you check for magic square palindromes, but you get AC if you only check that the input string is palindromic.
A separate issue: for some reason I get WA when I submit ANSI C code, but AC when I convert it to C++. Any ideas why this could be? The only thing I can think is that I'm not handling non-ASCII characters correctly but I haven't been able to write a test case that breaks the C version.
Re: 11221 - Magic square palindromes
Posted: Thu Jun 20, 2013 1:34 am
by brianfry713
Yes a simple check for a palindrome will get AC, but so will following the full problem statement and checking for a magic square palindrome. Your code must have had an issue with that, because mine gets AC either way.
There are some differences between the C and C++ compilers, I'd have to see your code to say why.
Re: 11221 - Magic square palindromes
Posted: Fri Jun 21, 2013 1:23 pm
by thomp
Right you are, I wasn't identifying magic squares correctly. It's unfortunate that there's not a test case that is a palindrome but isn't a magic square palindrome.
Re: 11221 - Magic square palindromes
Posted: Sat Mar 01, 2014 3:34 pm
by rafid059
"madam i'm adam" is a palindrome but not a square palindrome. I used this as an input at uvatoolkit.com and i got "no magic" for that.
Can someone explain why the following is a square palindrome? Do i ignore all the uppercases AND numbers AND punctuations?
sa!!!!!t,,or .ar.ep??o tenMHGJHet o())()( pe3286487325ra r{}o[]tas
Re: 11221 - Magic square palindromes
Posted: Sat Mar 01, 2014 8:28 pm
by brianfry713
There are no upper case letters in the judge's input.
Re: 11221 - Magic square palindromes
Posted: Fri Aug 08, 2014 12:14 pm
by Shahidul.CSE
Re: 11221 - Magic square palindromes
Posted: Fri Aug 08, 2014 9:56 pm
by lbv
Shahidul.CSE wrote:Why WA? I tested all sample inputs on this topic. My code is always giving correct output.
Try:
Input
Output