11193 - Infinix

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

Post Reply
domino
New poster
Posts: 19
Joined: Thu Dec 25, 2003 6:01 pm

11193 - Infinix

Post by domino »

I tried solving this one with dynamic programming but I keep getting WA. Does anybode have some tricky test cases?
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post 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?
domino
New poster
Posts: 19
Joined: Thu Dec 25, 2003 6:01 pm

Post 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?
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post 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
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post 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.
Last edited by rio on Tue Mar 06, 2007 11:11 am, edited 1 time in total.
domino
New poster
Posts: 19
Joined: Thu Dec 25, 2003 6:01 pm

Post by domino »

I got accepted and my outputs are:

Code: Select all

5
10
14
11
10
14
13
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post by rio »

Thanks domino ! :D I got AC.
tanaeem
New poster
Posts: 26
Joined: Mon Mar 12, 2007 6:58 pm
Location: BUET
Contact:

Is there any other special input

Post 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?
tanaeem
New poster
Posts: 26
Joined: Mon Mar 12, 2007 6:58 pm
Location: BUET
Contact:

Post by tanaeem »

I have got AC :D
made simple mistake :oops: in input like (1+1)+(1+1)
windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Post 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
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post 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.
Post Reply

Return to “Volume 111 (11100-11199)”