2062 WA!!!

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Post Reply
Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

2062 WA!!!

Post by Obaida » Sun Jan 11, 2009 9:21 am

Some one plz help me i got WA.

Code: Select all

removed
Last edited by Obaida on Sun Jan 11, 2009 12:19 pm, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

Re: 2062 WA!!!

Post by newkid » Sun Jan 11, 2009 11:06 am

try this input

Code: Select all

abc
end
my program outputs

Code: Select all

<abc> is acceptable.
your program outputs

Code: Select all

<abc> is not acceptable.
hope this helps..
hmm..

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 2062 WA!!!

Post by Obaida » Sun Jan 11, 2009 12:18 pm

Thank you. But still Wa!!!!

Code: Select all

removed
Last edited by Obaida on Mon Jan 12, 2009 6:31 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

Re: 2062 WA!!!

Post by newkid » Mon Jan 12, 2009 2:17 am

There are several anomalies/bugs in your code.

first of all, the if condition is wrong and should never be written in the way you wrote..

Code: Select all

if((st[i-1]==st[i-2]&&i>=2)||(st[i-1]==st[i+1]&&i<len-1)){acc = 0;break;}
it should be..

Code: Select all

if((i >= 2 && st[i - 1] == st[i - 2]) || (i < len - 1 && st[i - 1] == st[i + 1]))...
what i want to say is the boundary condition i >= 2 or i < len - 1 must be checked first and then array accessing..

and i think your code will fail in the following input..
bcda

it prints bcda is acceptable but its not..

hope this helps..
hmm..

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 2062 WA!!!

Post by Obaida » Mon Jan 12, 2009 6:32 am

Thank you.
I got acc. :(
try_try_try_try_&&&_try@try.com
This may be the address of success.

Post Reply

Return to “ACM ICPC Archive Board”