Some error occured while loading page for you. Please try again.
Sort 4 Discussions, By:
Please Login in order to post a comment
I keep getting a "runtime error" using F#.
I've downloaded the a couple of the "failed" datasets and run it locally - they run perfectly fine, producing correct results, with 50000 and 100000 inputs.
I can only surmise the issue is with the input string size. So this seems to be a test not of the algorithm but how you can efficiently process an extremely large console input.
I've not had this issue on any other challenges. I've tried reading the input in a variety of ways (buffered, using StringBuilder, stdin.ReadLine(), streaming using stdin.Read) and all result in "runtime error".
Any thoughts or advice appreciated.
Recommendation for those using F#. You will not be able to load an array with 10^5 items. It will give a runtime exception. This problem is looking at both time and memory constraints. I needed to solve this problem while I was reading input - i.e. treat it as a streaming problem.
This is the same as Largest Rectangle in Data Structures > Stacks where you can use any language you want to solve it.
Is there any Erlang solution that passes the time constraint for this challenge? Try as I might to solve this problem in Erlang, I failed. I just want to check if such a solution exist in the first place or not.
My Erlang solution passed.
It seems the test cases are kind of weak. I have a solution that it's very slow when the input it's sorted. i.e. when the fences are [1, 2, 3, 4, 5, 6]
To give an idea, I tried with [1..30000], compiled with ghc -O2, and it took 29 seconds, and the input size constrain is 100000
No more comments