What are your favorite "gotchas" in competitive programming?

Revision en1, by megaspazz, 2022-09-26 18:17:47

I saw in the comments of Codeforces Round #823 (Div. 2) that many C++ users needed to use setprecision to get AC on problem B. Fortunately, as a Java user, I didn't face the issue this time, but it made me wonder: what are some "gotchas" that people who are newer to competitive programming should look out for?

I also recall that in last year's FB HackerCup, where we need to run code locally, a friend of mine who uses C++ didn't set their local stack size high enough and therefore couldn't successfully run their otherwise-correct code on the full input set.

I know for Java, I painfully learned early on that Java's sort routines on primitive arrays have worst case O(n^2) runtime using a Quickselect variant, and that very smart hackers can construct adversarial inputs that cause a Java solution to get TLE.

So, in your experience, what are some things that have tripped you up?


  Rev. Lang. By When Δ Comment
en1 English megaspazz 2022-09-26 18:17:47 957 Initial revision (published)