11151 - Longest Palindrome

All about problems in Volume 111. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo »

artie wrote:[Thanks a lot!
Could anyone explain me why my input was faulty?
If you got AC, you may remove your code.. so it would not be a spoiler..
Spykaj
New poster
Posts: 47
Joined: Sun May 21, 2006 12:13 pm

Post by Spykaj »

I used Longest Common Subquecense for string A and reversed string A, is it correct ?
helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo »

Spykaj wrote:I used Longest Common Subquecense for string A and reversed string A, is it correct ?
Yes..
Monsoon
Learning poster
Posts: 66
Joined: Fri Jul 23, 2004 4:42 pm
Location: Poland

Post by Monsoon »

hmm... in my opinion during the contest tasks should be clear. This mean that you can solve them iff you find correct algo. Situation when someone must think about why he has WA, but algo seems correct is very stressful :wink:. And now is it becouse of my implementation? algorithm? tricky case? or now even how i read input or write output? :x . So what i can say about this task - ofcourse NONE can complain that they didn't solve this problem becouse of problem with reading empty lines, but the problem setters should avoid such situations.
Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer »

To those who feel bad about the "empty string" thing:

I don't see why you feel bad. Maybe you don't have time to read the problem statement carefully, but it has made everything clear. As for empty strings, from the problem description:
Here, we consider also the empty string as a palindrome.
Now your program didn't handle empty strings and you said the problem statement is unclear... What the logic here? :-?

(Just my personal opinion. Thank you.)
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
artie
New poster
Posts: 8
Joined: Sun Dec 31, 2006 11:56 am
Location: Russia

Post by artie »

Observer wrote:To those who feel bad about the "empty string" thing:

I don't see why you feel bad. Maybe you don't have time to read the problem statement carefully, but it has made everything clear. As for empty strings, from the problem description:
Here, we consider also the empty string as a palindrome.
Now your program didn't handle empty strings and you said the problem statement is unclear... What the logic here? :-?

(Just my personal opinion. Thank you.)
IMO when algo is correct as it's implementation, getting WA is very bad
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

As the problem statement clearly indicated there could be empty strings, I don't think there is any reason to be frustrated !!

If this problem is unclear, then I wonder what you will say to icpc regional, coimbatore 2005... :-?
Monsoon
Learning poster
Posts: 66
Joined: Fri Jul 23, 2004 4:42 pm
Location: Poland

Post by Monsoon »

I don't feel bad about this..Btw i immediately noticed that empty string can occur. But i had many wa's with an empty string just after number of testcases. ;-)

Code: Select all

scanf("%d\n",&t);
while(t--) {
...;
gets(str);
...
}
has wa, to get acc i have to use this

Code: Select all

scanf("%d",&t);
gets(str);
while(t--) {
...;
gets(str);
...
}
I know that it was only my fault (i should know that this problem can occur, but i'm solving problem for couple years and never met such situations) and i wrote that none can complain about that, but i suggested to problems setters that in my opinion they should avoid such situations, please don't take it personal :-)

P.S. i NEVER said that the problem set was unclear, i only complain about using special cases with reading input to make tasks harder...
Karim
New poster
Posts: 7
Joined: Sun Sep 24, 2006 4:11 pm

Post by Karim »

i used longest common subsequence between string A and reversed string A

but i am getting WA

can anyone help me ??

Code: Select all

cut got AC 
a stupid mistake :oops: (small array )

Thanks
deepesh
New poster
Posts: 13
Joined: Sat Dec 23, 2006 5:57 am

Wrong answer.

Post by deepesh »

Following is my code during the contest. I have tested many of the edge cases including empty string. And this works. Can you give me a few more edge cases?

I keep getting wrong answer.

Code accepted now. Removed this.
Last edited by deepesh on Mon Jan 01, 2007 8:13 pm, edited 1 time in total.
Monsoon
Learning poster
Posts: 66
Joined: Fri Jul 23, 2004 4:42 pm
Location: Poland

Post by Monsoon »

Like I said empty line just after number of testcases is really ... ;-)
when you use scanf("%d\n",&cases); you ate it :-)

Code: Select all

2

aa
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

to deepesh:

use this

Code: Select all

scanf("%d", &cases);getchar();
instead of

Code: Select all

scanf("%d\n", &cases);
deepesh
New poster
Posts: 13
Joined: Sat Dec 23, 2006 5:57 am

Wrong answer.

Post by deepesh »

My code has got accepted. Can you explain as to why the scanf ate away the charater?
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Re: Wrong answer.

Post by emotional blind »

deepesh wrote:My code has got accepted.
So please remove it.
Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer »

Monsoon wrote:I know that it was only my fault (i should know that this problem can occur, but i'm solving problem for couple years and never met such situations) and i wrote that none can complain about that, but i suggested to problems setters that in my opinion they should avoid such situations, please don't take it personal :-)
I didn't say that you complain. :) And I said "personal" just because I am NOT the problemsetter of this task!! :wink:
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org
Post Reply

Return to “Volume 111 (11100-11199)”