Page 1 of 2

10848 - Make Palindrome Checker

Posted: Mon May 09, 2005 9:19 pm
by L I M O N
pls anyone hlep me about this problem.
i think this is an easy problem, but getting WA again and again. what's the tric ??
pls HELP ME.

L I M O N

Posted: Mon May 09, 2005 10:15 pm
by QulinXao
All simple
u MUST very cerefull
u must right test p1
0<length(s1)<1001 0<=n<... etc

Posted: Tue May 10, 2005 12:08 am
by Sanny
Check if there is more than one space between inputs. I gave a check like this -

Code: Select all

if (length of 1st string + length of 2nd string + length of number + 2 != length of input line)
return false
Regards
Sanny

Posted: Tue May 10, 2005 12:42 am
by Krzysztof Duleba
More than one space between input fields was easy to notice. What I missed in my few first submissions was that a space could occur after the second string. Fixing that gave me AC.

Posted: Tue May 10, 2005 6:07 am
by ..
I think the problem statement is so clearly written, as it doesn't give insturction to reject trailing space after second instruction. If there are no words asking me to reject it, I assume it should be accepted.

Also, it is not clear what we should do if the length of string is zero.(In my AC program, I give T for P1)

Posted: Tue May 10, 2005 10:01 am
by dumb dan
> Also, it is not clear what we should do if the length of string is zero.(In my AC program, I give T for P1)

Giving T for P1 seems like the right thing to do, but I can also note that my AC program gives F for P1 when the second string is of zero length. So there cannot be any such inputs.

Posted: Tue May 10, 2005 11:48 am
by L I M O N
Sanny wrote:Check if there is more than one space between inputs. I gave a check like this -

Code: Select all

if (length of 1st string + length of 2nd string + length of number + 2 != length of input line)
return false
Regards
Sanny
thanks Sanny, that was my problem. i just got AC now.

Posted: Wed May 11, 2005 7:57 am
by neno_uci
Hi:

I think I've checked everything but that's obviously not true due to my WA :(, could you see my code and tell me what is wrong?

Code: Select all

Cut after AC
Thanx in advance,

Yandry. :oops:

Posted: Wed May 11, 2005 9:39 am
by mf
Consider the test case: " 0 " (a space, a zero, a space, a newline). My output: "TTTTTTF The solution is not accepted"

Also, the property #5 can be checked with a greedy O(n+m) algorithm.

Posted: Wed May 11, 2005 8:09 pm
by neno_uci
Could anybody give me some hard input cases?, I've solved the problem that mf told me...

Question

Posted: Thu May 12, 2005 12:54 am
by [_TANG_]
If P1 is false, then all the next conditions are false too?

I can't get AC ... :cry: ... I've fix all bugs I thought and my code crash all the time.

Can anyone help me?

thnx
____________
[_TANG_]

Posted: Thu May 12, 2005 2:15 am
by neno_uci
You are right TANG, please some test cases..., this is driving me maaaaaaaaaaaaaaddddd :oops:

Posted: Thu May 12, 2005 12:34 pm
by mf
I checked your code. Firstly, don't use scanf() for parsing the input (you said you had fixed that). Secondly, the line

Code: Select all

if (n1 > 1000 || n2 > 2000) return 0;
should read:

Code: Select all

if (n1 > 1000 || n3 > 2000 || n2 == 0) return 0;
I've been able to make your code above accepted. If you want, I'll send you the changes I made.

Posted: Thu May 12, 2005 2:03 pm
by neno_uci
Thanx a lot mf!!!, I solved it with that last hint :D , you are a great helper :wink:

Posted: Thu May 12, 2005 4:27 pm
by [_TANG_]
if the 2