Page 2 of 4
Posted: Sun Feb 08, 2004 12:16 pm
Hi Mahmud,

Your output does not seem to be right.

Example:
()*()
this should give a negative result----- but your one doesn't;
the corresponding closing of the first should be the last.
Hope it helps.

### Not Specified

Posted: Tue Feb 10, 2004 11:40 am
Hi Sohel,
I think the above sample inputs and outputs are not wrong as I got accepted with this inputs and outputs. You said,
()*()
this should give a negative result----- but your one doesn't;
the corresponding closing of the first should be the last.
But, I think, here () is followed by a separate character * and this sequence is followed by another ().As () is a correct sequence so, I think, ()*() should give positive answer. After all I got accepted in this way.

Mahmud

Posted: Fri Mar 05, 2004 4:07 pm
Hi,

I'm getting WA for this problem.

Can someone explain me why these 2 inputs give different outputs.
((**)()a+b)[(a){a+n}](*
((**)()a+b)[(a){a+n}](

And I'm not sure what this statement means?
"If the expression is not properly nested your program should determine the position of the offending bracket, that is the length of the shortest prefix of the expression that can not be extended to a properly nested expression."

Thanx,
angga888

### don't think so

Posted: Sun Mar 07, 2004 6:59 am
Hi again,
((**)()a+b)[(a){a+n}](*
((**)()a+b)[(a){a+n}](
How do you know these two inputs give two different outputs---
my AC program gives the same output..... very strange.
And I'm not sure what this statement means?
"If the expression is not properly nested your program should determine the position of the offending bracket, that is the length of the shortest prefix of the expression that can not be extended to a properly nested expression."
this is actually the first bracket (from left) that is out of position.

eg. ())[]9()909

it will be impossible for a valid combination to emerge after the third bracket ..).. therefore this particular one is the offending one.

Hope it helps.

### Not specified

Posted: Sun Mar 07, 2004 2:10 pm
Hi:
Sohel is correct.

Here, '(*' has to be considered as different characters
as '(*' is not completed and they are the last two characters in
that sequence.
((**)()a+b)[(a){a+n}](*

Posted: Sun Mar 07, 2004 2:39 pm
Hi,
How do you know these two inputs give two different outputs---
my AC program gives the same output..... very strange.
I look at the first post in this topic and I've got AC now.

Regards,
angga888

Posted: Sun Jun 20, 2004 4:34 pm
Which one is wrong, Problem description or the sample input ????

Posted: Sun Jun 20, 2004 4:36 pm
When I get a WA in the problem, then I check out some help for me and I test the sample input given by Mahmud776. I was mad with his sample input because I fail to match with his output. But those are output from his AC code. So I was not confident to say his output was wrong.

But finally understanding the problem properly I get AC and find that his output was wrong. I think Judge Data is not strong enough to test the solution of problem. Though I think the problem was little confusing because it ask for the minimum prefix which can't extended as correct one.

For example:

()()(a+b)(

Output for it: NO 11

But that expration can be extended as correct one like; ()()(a+b)()
So output should be 'YES' rather 'NO 11'

### 551

Posted: Sun Oct 17, 2004 8:38 pm
Hi:
Can anyone help me?
I only need the outputs for this inputs, or others inputs/outputs with some special cases.
Thanks!

Input:

(a*)
)()
*)()
(***)
(**
({{]}]
(**){*{]}]
<><
<sgf(sfg[sfg{sfg(*sfgsdfg*)dhj}]dfh)>
<sgf(sfg[sfg{sfg(*sfgsdfg*)dhj}]dfh)><
<sgf(sfg[sfg{sfg(*sfgsdfg*)dhj}]dfh)>(*
[**
((((())
(*(*(*(**)*)
(**********(
(*a++(*)
(*a{+}*)
(*)
(**)
((**))
((()))
{}{}{}{}{}{}{}{}{
{{{}[()((**))][][]}}
(())))
(***)
{*(())(()*)*}

Posted: Thu Oct 21, 2004 7:53 am
No 9
No 9
No 3
No 1
No 1
Yes
Yes
No 3
No 4
No 6
No 4
Yes
No 37
No 37
No 4
No 8
No 7
No 12
No 6
Yes
No 2
Yes
Yes
Yes
No 18
Yes
No 5
Yes
No 10
Yes
Yes

Posted: Fri Oct 22, 2004 6:54 am
I got AC to the first!
I only had a small mistake!
Thanks!

Posted: Fri Apr 08, 2005 4:28 am
Dear Mahmud776,
one of the sample cases you have posted here is wrong. for the input

Code: Select all

``((**)()a+b)[(a){a+n}](``
you said the output is

Code: Select all

``NO 20``
which is wrong. my AC code gives output

Code: Select all

``NO 21``
I guess this is a silly typo. Again, for the case

Code: Select all

``````((**)()a+b)[(a){a+n}](*
``````
I considered the last '(*' as one symbol and that is what one is supposed to for all the cases in this problem.

Posted: Mon May 30, 2005 3:38 pm
Apparently the output logic of this problem is quite arguable.

I tend to agree with Rajib's theory that for
cases like

Code: Select all

``()()(a+b)(``
the output should be

Code: Select all

``YES``
because strings of this kind can be extended so that they
represents a valid bracketing ( a valid expression ).
I mean they have no prefix for which no extension is possible.

But I doubt the Judge's tests follow this
logic ( Rajib's theory ).

I found another thread where there's sufficient I/O.

http://online-judge.uva.es/board/viewtopic.php?t=6724

jagadish has posted some output there which
is quite close to mine although it differs in some cases.

We differ in the following test cases:
input

Code: Select all

``````[**
((((())
(*(*(*(**)*)``````
my output

Code: Select all

``````NO 2
NO 4
NO 3``````
his output

Code: Select all

``````No 4
No 8
No 7``````
It would be nice if someone having ACC program could
verify and say which one of these outputs is correct. I hope
he/she won't come up with a new theory about
how a correct answer should look like

Posted: Mon May 30, 2005 5:31 pm
Can someone explain these outputs

Output

Code: Select all

``````No 3
No 4
No 8
No 7 ``````
for the following

Input

Code: Select all

``````(**
[**
((((())
(*(*(*(**)*)``````

My WA program currently prints

Output

Code: Select all

``````NO 2
NO 2
NO 4
NO 3``````
for that sample input.

Could someone explain if/why my output is wrong
and if/why the first output ( from jagadish ) is OK ?

These are the only test cases in which my Output differs
from jagadish's Output for his sample Input ( see above ).

I have made also a post in
http://online-judge.uva.es/board/viewtopic.php?t=4897
but that thread is even more confusing. The theory of Rajib
seems reasonable to me but when I follow it the Judge still
gives me WA. Although I would say this interpretation is the
most correct one ( logically ).