Unhackable List

Revision en9, by eidan, 2019-02-16 20:32:20

Last round involved a randomized solution for problem E, and some pretests were aimed against std's rand() function. This caused a big dispute among contestants. It was questioned whether doing this type of tests was fair or necessary, since passing them depended merely on specific language knowledge, not actual problem-solving skills. Contest coordinators counter-argued that participants would've gotten hacked if it hadn't been for these pretests. They also stated that it's one's responsibility to know their favorite language when using it on a round.

The fact is, this controversy was really caused by a technical property within C++ (and codeforces, partly), which many people had no clue existed. This is just an example of the fact that languages and their functioning in CF will sometimes have non-intuitive and unexpected properties, which may screw our performance in a contest. In other words, we are constantly exposed to bumping into another of these hidden behaviors, making the mentioned round hardly the last time something like this can happen.

That's why I thought: We should have a list of the main language-specific issues that could annoy us during contests. Just a brief enumeration of not-so-fun facts about languages, such that, if not known, could break our solutions or get us hacked. Making a brief list available for the community, and exposing it to participants before a round could prevent a lot of trouble. If a problem could make you bump into one of these weird language issues, contest coordinators could safely assume we know about them and not get into a moral debate whether it's fair to include tests against it. Also, contestants would be safe from losing rating to specific language knowledge. In other words, we could prevent issues like the last round's with the least amount of effort.

This blog is an attempt to build up this list once and for all! It should include as much facts as possible, so I'm calling out for your help. If you've had trouble on a problem because of issues in the language, I invite you to help out contributing and write it as a comment. I'll update it in the list as soon as possible. You'd be helping out and preventing other people from going through the same annoying experience! I've included the very few facts I know about for now. It's not much, which is why anything you can share is useful!

# Unhackable List

## C++

Don't use rand()
unordered_map can cause TLE
std::random_device is unsafe in MinGW w64
multiset::erase is unusual
std::pow disregards precision
size() in data structures is unsigned

## Java

Arrays.sort() may cause TLE

## Python

Python recursion has low limit

#### History

Revisions

Rev. Lang. By When Δ Comment
en10 eidan 2021-01-27 23:44:08 702
en9 eidan 2019-02-16 20:32:20 8
en3 eidan 2019-02-14 23:10:00 2284 Tiny change: 'se $O<sup>2</sup>$. [' -> 'se $O(n<sup>2</sup>)$. ['