Odd bad_alloc error

I am coding a solution to the USACO barn repair problem (Problem Statement: http://frostpines.wordpress.com/2010/11/06/usaco-1-3-2-barn-repair/ ).

The solution I have coded runs seamlessly on the test data on my pc and on ideone.com (link: http://ideone.com/qWyt1G ). I get a std::bad_alloc error on the USACO server.

I cannot find the error, any help would be greatly appreciated.
Have you tried catching that exception and printing out some diagnostic message? Does their server let you see your output in the case of a failure like that?
I could try that, I would have to print to cerr. My only problem with that is where would i place the try catch blocks? Do I place multiple? Would you mind giving an example please?

Also, that you for the help thus far.

I have found the error to be in line: 15
However, I am still confused.
Last edited on
Topic archived. No new replies allowed.