Making a Contest Template
Some contests allow you to use prewritten code, but most other contests -- such as USACO -- require you to write out all your code during the contest. This either means no templating or templating very effectively so that you produce something you can easily write from scratch in contest.
First, we have the bare minimum design below:
Just this much allows you to use fast IO, read and write from a file if possible, and use anything from the standard library, meaning that it should be considered a bare minimum for your code.
One thing we can immediately add is the GNU policy data structures for hashing and ordered sets, since this allows us to use absolutely all of the resources provided to us under the g++ compiler and these DS are frequently helpful gold and above (there is also ext/rope
with the namespace __gnu_cxx
, but it is almost never useful and thus not included):
At this point, we have constructed a good basic template to use. If you want to add more utilities such as macros and so on, make sure you produce a template you can memorize to prevent stressing near contest day. Find a balance between what you can memorize and include and what you should simply leave out.
Last updated