10700 - Camel trading

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

10700 - Camel trading

Post by Eduard » Fri Aug 27, 2004 6:01 pm

Sorry for putting this topic in volume CVI but at thismoment ther is not Volume CVII.
I don't know why i'm geting WA.My solution is good solution I use DP and get right answers for simple input.
I saw that nobody at this moment have got this problem AC by Pascal.
Whats wrong. :roll:
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Fri Aug 27, 2004 8:36 pm

Well, I just got accepted in Pascal (with my alter ego account xenon, else it wouldn't show up in the list :) ), so there shouln't be any problem.
You can use DP, but, as Per stated somewhere, there also is a greedy approach which is a lot faster. And like him, I'm also not 100% convinced that it works for all special cases. But hey, AC is AC.

liulike
Learning poster
Posts: 52
Joined: Wed Jul 30, 2003 10:56 am

Post by liulike » Fri Aug 27, 2004 8:38 pm

My solution is as follw:
define the operator preority by yourself.
If you want to get the max , the *'s preority should be greater than +
also, If you want to get the min , the +'s preority should be greater than *

After that, you should only calculte the expression's value.

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard » Fri Aug 27, 2004 9:16 pm

Hello little joey If you got AC by Pascal then tell me please did you use Longint or something else int64,qword..?
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Fri Aug 27, 2004 10:04 pm

I use int64 since 20*20*20*20*20*20*20*20*20*20*20*20 > 2^31.

User avatar
_.B._
Experienced poster
Posts: 160
Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:

Pascal.

Post by _.B._ » Mon Aug 30, 2004 7:01 am

Greetings all!
I solved this one in Pascal too.
I used QWord.
I made it in a pretty mechanical way 8)
A couple of arrays of strings, and such.
Got time 0:00.598, but ACed :D

Keep posting!
_.

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:

10700 WA

Post by Minilek » Mon Aug 30, 2004 12:24 pm

AC
Last edited by Minilek on Mon Aug 30, 2004 6:09 pm, edited 1 time in total.

Examiner
New poster
Posts: 27
Joined: Thu Feb 19, 2004 1:19 pm

Re: problem with 10700

Post by Examiner » Mon Aug 30, 2004 1:03 pm

Eduard wrote:I don't know why i'm geting WA.My solution is good solution I use DP and get right answers for simple input.
I saw that nobody at this moment have got this problem AC by Pascal.
Whats wrong. :roll:
Did you define infinity correctly? That was my problem.

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:

Post by Minilek » Mon Aug 30, 2004 2:03 pm

EDIT:
Don't be dumb like me. In calculating how big your char array should be for holding the expression, remember that numbers can be 2 digits :-?

[c]
AC
[/c]

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:

Post by Minilek » Mon Aug 30, 2004 6:03 pm

[c]
AC
[/c]

EDIT:
To anyone else who may have the same stupid problem I did. The string I used to hold the expression was a char array of size 24 (at most 12 numbers, at most 11 operators, plus the '\0'). However, I forgot that some numbers could be 2 digits, which means the array size should have been at least 36 :-?

wolf
New poster
Posts: 34
Joined: Sun Aug 22, 2004 4:20 am
Location: Poland

Post by wolf » Thu Sep 02, 2004 2:29 pm

I got AC by c++

If it help someone I can say that the double is the right type of data for this problem :-D

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard » Thu Sep 02, 2004 4:14 pm

Examiner was right i made the infinity wrong because i write it for longint and infinity=maxlongint.Now I chang infinity=5*10^15 and got AC.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

Junayeed
New poster
Posts: 50
Joined: Sat Oct 26, 2002 9:02 am
Location: Dhaka, Bangladesh

Post by Junayeed » Sun Sep 12, 2004 5:03 pm

To Eduard,

Why do I need 'infinity'. Please explain.
And what is the output for the following input

20*20*20*20

160000 and 0.(Max and min)

Thanks.
Junayeed

Junayeed
New poster
Posts: 50
Joined: Sat Oct 26, 2002 9:02 am
Location: Dhaka, Bangladesh

Post by Junayeed » Sun Sep 12, 2004 6:53 pm

I think my output was wrong. I think the output will be like this :

160000 and 160000.(Max and min).

Is it ok.

Thanks
Junayeed

Junayeed
New poster
Posts: 50
Joined: Sat Oct 26, 2002 9:02 am
Location: Dhaka, Bangladesh

Post by Junayeed » Mon Sep 13, 2004 2:27 pm

My previous output was right.
I got AC now.

Thanks
Junayeed

Post Reply

Return to “Volume 107 (10700-10799)”