Search found 105 matches

by Maniac
Wed Nov 10, 2004 10:49 am
Forum: Volume 8 (800-899)
Topic: 843 - Crypt Kicker
Replies: 51
Views: 25199

what is the compile error you get? You can see this in your e-mail.

If you don't receive an e-mail for every solution you send in, change your preferences or user options or something like that...
by Maniac
Wed Nov 10, 2004 10:44 am
Forum: Java
Topic: How to deal with really BIG numbers in JAVA?
Replies: 3
Views: 2571

Yes, I do. Make your own BigInteger class and use that :-) See other threads to find out how to implement a BigInteger class
by Maniac
Wed Nov 10, 2004 10:42 am
Forum: Java
Topic: Anyone knows how to speed up JAVA a little bit?
Replies: 9
Views: 7330

Hi, I'm sorry to disappoint you, but there are lots of problems which can't be solved with Java just because Java is some factor slower than the other languages (and the admins don't take this into account). My experience is that Java is 2-10 times slower than C for example (depending on the problem...
by Maniac
Tue Nov 02, 2004 2:39 pm
Forum: Off topic (General chit-chat)
Topic: ICPC Java
Replies: 4
Views: 2147

I don't know about all regionals and finals, but at the NWERC (north west europe) Java is fully supported (with maybe some unimportant restrictions). My team has succesfully competed in several NWERC's using Java.

But why don't you just ask your contest director?
by Maniac
Mon Nov 01, 2004 1:15 pm
Forum: Java
Topic: NEED HELP, PLEASE!!! URGENT!!!!!!
Replies: 2
Views: 2520

both problems should indeed keep on handling test cases until EOF (end of file) is detected. See another thread on this java-forum called 'Java useful methods to save time' and you'll find a way to detect EOF. Does this help you enough? Greetz, Erik P.S. of course input and output are separate strea...
by Maniac
Mon Oct 25, 2004 9:49 am
Forum: Algorithms
Topic: calculate n choose k
Replies: 5
Views: 1861

Yes, your right. That would certainly avoid the overflow. Thanks!
by Maniac
Fri Oct 22, 2004 7:06 pm
Forum: Volume 107 (10700-10799)
Topic: 10743 - Blocks on Blocks
Replies: 20
Views: 10929

How do you guys make quotes with author names above? Larry: if f[n+1] = a f[n] + b f[n-1] + c f[n-2] then the matrix is {{a,b,c},{1,0,0},{0,1,0}}. Does that help? Per: sorry, no derivation :-) just calculating the first few values and using the encyclopedia of integer sequences... I haven't got a cl...
by Maniac
Fri Oct 22, 2004 12:52 pm
Forum: Java
Topic: Compile Error-Double
Replies: 2
Views: 1993

The judge uses java 1.1 (it's from the stone age, I know) and it doesn't support the parseDouble method. Use this [java]Double.valueOf(s).doubleValue();[/java] instead of [java]Double.parseDouble(s);[/java] If you want, you can download the java 1.1 documentation. Then you can really find out how ba...
by Maniac
Fri Oct 22, 2004 2:32 am
Forum: Volume 107 (10700-10799)
Topic: 10743 - Blocks on Blocks
Replies: 20
Views: 10929

I haven't solved this problem yet, but I do know that there is a very simple recursive formula for the requested number: a[1] = ... ... a[5] = ... a[n] = ? a[n-1] - ? a[n-2] + ? a[n-3] with positive integers in stead of question marks (not giving it all away). So whenever three values in a row have ...
by Maniac
Fri Oct 22, 2004 2:05 am
Forum: Volume 107 (10700-10799)
Topic: 10746 - Crime Wave - The Sequel
Replies: 27
Views: 17404

this turned my WA into AC.
WA:[cpp]if(dist[j] + w[j][k] < newdist[k])
[/cpp]

AC:[cpp]if(dist[j] + w[j][k] + 0.000001 < newdist[k])
[/cpp]

In other words, be careful with comparing doubles during your search for a negative cycle.
by Maniac
Fri Oct 22, 2004 1:57 am
Forum: Algorithms
Topic: negative weight cycles and Bellman-Ford
Replies: 2
Views: 1319

This was exactly the procedure I had in mind but when I sent it in I got WA. After that I started to doubt about the correctness of the approach... Anyway, I've got AC for the Crime Wave problem now. Turns out that the problem was with comparing doubles. WA: [cpp]if(dist[j] + w[j][k] < newdist[k]) [...
by Maniac
Tue Oct 19, 2004 4:42 pm
Forum: Algorithms
Topic: negative weight cycles and Bellman-Ford
Replies: 2
Views: 1319

negative weight cycles and Bellman-Ford

Hi all, I have a problem: how do I efficiently find a negative weight cycle in a directed graph once I know that one exists? I know that with Bellman-Ford one can check whether a graph contains a negative cycle, but the algorithm doesn't give me the actual cycle. I came upon this problem when lookin...
by Maniac
Mon Oct 18, 2004 5:18 pm
Forum: Volume 107 (10700-10799)
Topic: 10744 - The Optimal Super-Highway
Replies: 29
Views: 14729

Cool, I never used countsort before but now I see the value :-) Got AC in 0.9 sec now.

I still wonder how one might find the median of an arbitrary array in linear time though....
by Maniac
Mon Oct 18, 2004 3:30 pm
Forum: Volume 107 (10700-10799)
Topic: 10744 - The Optimal Super-Highway
Replies: 29
Views: 14729

A small correction: during contest I got TLE. Now I get AC in 7 secs, but there is probably a faster algorithm cause lots of people have runtime under 1 sec.
by Maniac
Mon Oct 18, 2004 3:24 pm
Forum: Volume 107 (10700-10799)
Topic: 10744 - The Optimal Super-Highway
Replies: 29
Views: 14729

10744 - The Optimal Super-Highway

Unfortunately I get a TLE for this problem. My approach is the following: read all points, i.e. the cities then for each query: - construct a line through the given points (A and B), i.e. the "other" road - determine distance from each point to this line (negative distances for one side of the line,...

Go to advanced search