Page 1 of 1

11193 - Infinix

Posted: Tue Mar 06, 2007 1:21 am
by domino
I tried solving this one with dynamic programming but I keep getting WA. Does anybode have some tricky test cases?

Posted: Tue Mar 06, 2007 2:05 am
by sclo
did you handle cases like these properly?

1+1+1-1-1+1-1-1-1+1+1+1-1-1

Which operations could be done last?

Posted: Tue Mar 06, 2007 2:26 am
by domino
sclo wrote:did you handle cases like these properly?

1+1+1-1-1+1-1-1-1+1+1+1-1-1

Which operations could be done last?
If A=S=M=D=1 my program outputs 5. Is it correct?

Posted: Tue Mar 06, 2007 4:57 am
by sclo
domino wrote:
sclo wrote:did you handle cases like these properly?

1+1+1-1-1+1-1-1-1+1+1+1-1-1

Which operations could be done last?
If A=S=M=D=1 my program outputs 5. Is it correct?
Yes

Code: Select all

1 1 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1 
1 2 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1 
2 1 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1 
1 3 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1 
3 1 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1 
Output

Code: Select all

5
8
8
11
12

Posted: Tue Mar 06, 2007 10:51 am
by rio
Getting many WA.. Could someone verify my I/O?
Input:

Code: Select all

1 1 1 1
1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1
1 1 1 1
1/1/1/1/1/1/1/1/1/1/1
1 2 3 4
1/1*1/1/1*1*1/1*1
2 1 1 2
1+1+(1-(1-(1+1)-(1-1-1)+1+1+1)-1-1)
2 1 4 3
1-2/2*3+4-1*2
2 1 4 3
1+1*1-(1/1/1)*1*1/1+(1-(1+1*1)-1)/1
2 1 4 3
1+1*1*1/1-(1/1/1)+1*1/1+(1+1*1)-1/1+1
0 0 0 0
Output:

Code: Select all

5
10
13
11
11
14
13
Thanks in advance.

Posted: Tue Mar 06, 2007 10:55 am
by domino
I got accepted and my outputs are:

Code: Select all

5
10
14
11
10
14
13

Posted: Tue Mar 06, 2007 11:09 am
by rio
Thanks domino ! :D I got AC.

Is there any other special input

Posted: Mon Mar 12, 2007 7:09 pm
by tanaeem
My code gives correct output for all the sample given and the input given in this topic.
But still getting WA:(
Any other special inputs.
Will there be empty string as input?

Posted: Mon Mar 12, 2007 7:28 pm
by tanaeem
I have got AC :D
made simple mistake :oops: in input like (1+1)+(1+1)

Posted: Wed Mar 14, 2007 4:34 pm
by windows2k
[quote="rio"]Getting many WA.. Could someone verify my I/O?
Input:

Code: Select all

1 2 3 4
Output:

Code: Select all

14
[quote]
Could someone explain why ths answer is 14.
Thx anyway

Posted: Fri Mar 16, 2007 1:14 am
by sclo
Could someone explain why ths answer is 14.
Thx anyway
For

Code: Select all

1 2 3 4
1/1*1/1/1*1*1/1*1 
I don't see how you can do it with cost 13:
Here's a way to do it with cost 14:
(((1/1)*((1/1)/1))*(1*((1/1)*1)))

Remember that division can't be the last operation unless there are no multiplications after it.