Search found 20 matches

by happyson10
Thu Nov 15, 2012 10:15 am
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13241

WA on #104

import java.io.BufferedInputStream; import java.util.ArrayList; import java.util.LinkedList; import java.util.Locale; import java.util.Scanner; class Main { private static final String NOTFOUND = "no arbitrage sequence exists"; /* * Time O( ) Space O() */ public String arbitrage(double[][] array, in...
by happyson10
Thu Nov 15, 2012 5:38 am
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 27116

Re: help on #105

First write the simplistic code possible that will get AC. Then try and optimize it if you want. I'm agree, simple coding is very important, and there is a balance among performance, code lines and readability In fact, i think there is a room to make my above code smaller without the logic changing...
by happyson10
Thu Nov 15, 2012 4:55 am
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 27116

Re: help on #105

I solved this in less than 30 lines of code by storing the max height on each possible x coordinate. thanks, I knew the solution, it's pretty clear and simple, In fact, mine is kind of from it, the difference is 1 mine doesn't store for each possible x coordinate. 2 mine does binary search instead ...
by happyson10
Thu Nov 15, 2012 4:54 am
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 27116

Re: help on #105

brianfry713 wrote:Don't use a package.
http://uva.onlinejudge.org/index.php?op ... &Itemid=30
thanks, let me removed the package. And please help to check why it return WA
by happyson10
Wed Nov 14, 2012 11:26 pm
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 27116

help on #105

import java.io.IOException; import java.util.ArrayList; import java.util.StringTokenizer; class Main { public static ArrayList<Integer> RESULT_X = new ArrayList<Integer> (); //represent the vertical line (x-coordinate) public static ArrayList<Integer> RESULT_Y = new ArrayList<Integer> (); //represen...

Go to advanced search