Page 1 of 3
11136 - Hoax or what
Posted: Mon Oct 23, 2006 4:37 am
by helloneo
Hello..~
Can anybody tell me what is the output for this input..?
Thanks..~
Posted: Mon Oct 23, 2006 7:24 am
by Darko
I am not sure what interpretation you have, but isn't it obviously 3 (0+3)?
Posted: Mon Oct 23, 2006 7:30 am
by helloneo
Darko wrote:I am not sure what interpretation you have, but isn't it obviously 3 (0+3)?
Thanks for reply..
I was pretty sure about my program.. but getting WA..
So, I was wondering what I'm supposed to do if the highest bill and lowest bill is same..
Now I got AC with "long long"

Posted: Mon Oct 23, 2006 4:46 pm
by danielrocha
I'm not sure the problemsetter considered this, but this problem can be solved pretty easily using C++ STL's "multiset". At first I tought the test cases were made so that using STL would give a TLE, but it passed on 8s.
Posted: Mon Oct 23, 2006 5:20 pm
by arsalan_mousavian
danielrocha wrote:I'm not sure the problemsetter considered this, but this problem can be solved pretty easily using C++ STL's "multiset". At first I tought the test cases were made so that using STL would give a TLE, but it passed on 8s.
i used multiset too , but is there a faster way except using 10^6 size array?
tanx
Arsalan
Posted: Mon Oct 23, 2006 6:23 pm
by StanleY Yelnats
I used two priority queue however it was a WA
but the algorithm seems to be ok, i'm still working on it
( WA in 2.2sec )
Posted: Mon Oct 23, 2006 6:46 pm
by Emilio
I think if you implement your our heap, maybe, could be faster that an array, but this is data-dependent.
Posted: Mon Oct 23, 2006 8:07 pm
by Darko
About STL not timing out - did you use cin to read the input? I used Java's TreeSet with some modifications during the real contest, but it was TLE when I used Scanner but got AC when I used BufferedReader, which was probably generous of them, I don't know. I don't think that solving problems should depend on the way you read input.
Posted: Tue Oct 24, 2006 9:22 am
by arsalan_mousavian
Darko wrote:About STL not timing out - did you use cin to read the input? I used Java's TreeSet with some modifications during the real contest, but it was TLE when I used Scanner but got AC when I used BufferedReader, which was probably generous of them, I don't know. I don't think that solving problems should depend on the way you read input.
as it is mentioned in the problem statemant that the input size is 16MB , i used scanf to read the input
Posted: Tue Oct 24, 2006 3:05 pm
by Darko
We didn't have that information during the provincial contest. And even if we did, I don't see why using of scanf would be mandatory. The closest thing that comes to that in Java is Scanner, but is way too slow. I got it accepted here under 2 secs but with my own priority queue and some funky I/O. I don't think that one should have to reinvent those wheels (that are part of standard libraries) in order to solve a problem.
(Note: TreeSet, Scanner and BufferedReader are not available on UVa)
hmm
Posted: Tue Oct 24, 2006 3:33 pm
by shahriar_manzoor
At UVa we cannot allow time limit more than 10 second. To let the java pass we can make the input file smaller but that will allow mady bad C codes pass which it already did. So it is hard to make an adjustment. I know some other online judges allow more time for java but currently we don't have that provision.
Posted: Tue Oct 24, 2006 3:46 pm
by Darko
Well, just allowing BufferedReader would help a lot with Java I/O. I am not sure why it's not allowed here. You can use a buffer, its size is limited to 2048 bytes, but it works (that's how I read that 16MB file). But I've seen someone posting C code in which they used an 1MB buffer. So I have no idea why Java's buffer is limited in that way, too.
Posted: Tue Oct 24, 2006 3:49 pm
by Darko
hmm
Posted: Tue Oct 24, 2006 4:15 pm
by shahriar_manzoor
Try bugs and suggestions to ask carlos. I use very very limited amount of java (when I am forced to write a java soln) so I cannot comment on this.
Posted: Tue Oct 24, 2006 9:35 pm
by Artikali
i also used multiset, but i am getting WA
i am newer using STL