Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I definitely used this to my advantage in ACM ICPC contests. Most of the students and professors wrote the problems and benchmarked against Java. However, on several problems, it boiled down to "write this specific algorithm for this class of problem, or use C." I once netted my team an extra problem after we timed out in Java and I just rewrote the teammate's solution in C++.


My team used java in two cases: BigInteger or 'isProbableTime.' For everything else performance penalty was almost always unacceptable. C++ can also be sometimes finetuned enough to pass with unintended complexity (i.e. O(n lg n) instead of O(n)).


isProbableTime -> isProbablePrime.


Outside of some very specific parsing problems where Java standard library was very helpful, writing solutions in C was the way to go.

Though while it could allow certain parts of the code to be less efficient, if you had completely the wrong algorithm it wasn’t going to save you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: