Page 1 of 1

10840 - Multi-stage Compressor

Posted: Mon Sep 19, 2005 1:45 am
by Quantris
Just wondering if anyone has a hint about this one (I realise only two people have it AC anyway).

It seems like a pretty simple problem if I'm reading it right.

Perhaps something is off with the judge's data?

Re: 10840 WA ?

Posted: Sun Dec 11, 2005 12:54 pm
by Martin Macko
Actually I don't undestand the problem statement. I've read it so many times, but nothing helped. Is there anybody who understand the problem statement? Could you, please, explain it? Thanks. :D

Posted: Tue Feb 28, 2006 7:02 am
by Darko
I think that all that introduction is there just to say "we'll make it look like a real world problem, but it won't get anywhere close to being one..."

What they say (among other things) is that you are given the pressure in front of the compressor and the pressure behind the compressor and that there are n "stages" (sets of blades? rotors? not sure what the word is...). What they are asking is "What is the pressure behind (i-1)th 'stage'?"

From what they said about everything being ideal, seems like following is true:
p_n+1/p_n = p_n/p_n-1 = ... = p_3/p_2 = p_2/p_1 = k

So, k = (p_n+1/p_1)^(1/n) ?

And p_i = k^(i-1) ?

Well, that's what I tried, but it didn't work (works on the sample input, of course). I got WA after 2.5 secs (Java) and 0.5 sec (C).

There are no bounds on any of those, and I would've tried BigDecimal if UVa allowed it, but no luck there. So, if you have a BigDecimal library handy, go for it :)


Posted: Sat Jul 14, 2007 10:00 am
by little joey
Thanks Darko for clearing this out. This kind of insane problems really should be banned from UVA...

Re: 10840 - Multi-stage Compressor

Posted: Thu Dec 17, 2015 5:33 am
by Quantris
Thanks to uDebug I finally got AC on this problem.

There is a discrepancy between the data and problem statement. The statement says to output p_i, but actually what works is to output p_i / p_1. In other words we want not the output pressure after stage i but the compression ratio after stage i.

This case (just the sample case with pressures doubled) illustrates it:

2 2 4 1
2 2 4 2
2 2 4 3

the AC output is (same as sample output):

but the real answers following the statement should be:
[ p1 <= p_i <= p_n+1 should be true ]

I don't know if we'd prefer to correct the statement to match the data, or the other way around.