Page 2 of 2

Posted: Sat Jun 04, 2005 11:50 pm
by mf
Oops, sorry.
Then try these inputs instead. They're correct, I suppose.

Code: Select all

2
IF
IF
ELSE
END_IF
IF
ELSE
END_IF
ELSE
END_IF
ENDPROGRAM
IF
ELSE
IF
ELSE
END_IF
IF
ELSE
END_IF
END_IF
ENDPROGRAM
Outputs: 5, 5.

Posted: Sun Jun 05, 2005 7:26 am
by zhang
Thank u for your test data. I found a mistake and got AC.

Posted: Sun Jul 31, 2005 3:02 pm
by Raiyan Kamal
Thanks to mf for the test cases.

Posted: Tue Nov 22, 2005 6:12 pm
by Dominik Michniewski
Problem seems to be easy ...
I got correct output for every case in this board (and sample IO too ;) ) but I got WA, when I send it.

Could anyone help me? I can't see my mistake :(
Basically (I can send code, if someone requests for it) my algorithm is:
count all leafs on tree created from if-else-end_if statements. Multiply results from each separate if-else-end_if statement occured on root level of program (level of endprogram keyword).

I cover all cases with multiply number of if statements in row on any deep in tree.
Maybe someone post tricky case I missed?

Best regards
DM

Posted: Thu Nov 24, 2005 9:18 pm
by Dominik Michniewski
I'm so stupid :(
I make silly mistake, I got Accepted now.

Best regards
DM

WA again ?

Posted: Sat Jan 14, 2006 6:07 pm
by hoang

Code: Select all

1
IF
ELSE
IF
ELSE
IF
END_IF
END_IF
IF
END_IF
IF
ELSE
END_IF
END_IF
ENDPROGRAM
i got WA again. and plz see that test.
2 of my friend got accept but 1 have answer is 5 and another have 12 ( me 9 )

i dont know what is the right answer ?

Posted: Sat Jan 14, 2006 7:00 pm
by mf
That's not a correct input. Every IF must have an ELSE.

sorry

Posted: Tue Jan 17, 2006 2:20 pm
by hoang

Code: Select all

1
IF
ELSE
IF
ELSE
IF
END_IF
END_IF
IF
END_IF
IF
ELSE
END_IF
END_IF
END_IF
ENDPROGRAM
i think the result is 5 .

Re: sorry

Posted: Sun May 21, 2006 1:21 am
by Martin Macko
hoang wrote:i think the result is 5 .
This input is not correct, too. The IF and END_IF statements must be ballanced.

Re: 10854 - Number of Paths

Posted: Wed Feb 17, 2016 1:26 am
by solon_aguiar
Does anybody have other valuable inputs? My code passes all the inputs in this topic, but still getting WA.

Re: 10854 - Number of Paths

Posted: Wed Feb 17, 2016 4:55 am
by solon_aguiar
Got it accepted. The following case was helpful in debugging:

Code: Select all

1
IF
ELSE
END_IF
S
S
S
IF
ELSE
IF
ELSE
END_IF
IF
ELSE
END_IF
S
S
S
S
S
IF
ELSE
END_IF
END_IF
ENDPROGRAM
Output is

Code: Select all

18