Online Course Discussion Forum

USACO: under what size of data is it generally safe to use "brute force" solutions?

 
 
Picture of Dr. Kevin Wang
Re: USACO: under what size of data is it generally safe to use "brute force" solutions?
by Dr. Kevin Wang - Wednesday, February 15, 2023, 6:37 PM
 

On the Bronze level, when the data size is $N=100$, there is no significant difference between $O(N^2)$ and $O(N^3)$.  It's like 0.01 second and 1 second, you notice the difference in speed, but it won't be that much.  When $N=10^5$ or something like that, it will be quite different.

To find the bug in your program, print out some more intermediate results to debug (or use the debugger in your IDE).