Contest Tips
How Programming Contests Work
Teams of 2-3 people compete against each other to solve the most number of
problems in the least amount of time. At the beginning of the contest, a number
(usually 5 to 9) of programming problems are handed out. These programming
problems have an English description, sample input, and sample output. Problems
may be done in any order, and each problem has equal scoring regardless of its
difficulty.
Each team tries to write programs to solve the problems. Once a program is
done, it is submitted to the judges to determine if it's correct or not. If the
program is deemed correct, then that team scores a point. Otherwise, the
judges will send a response back with a single reason why the program is wrong
(although it's quite possible that there are multiple things wrong with the
program). If the team resubmits a correct program, then for each incorrect
solution submitted for that problem, a twenty minute penalty is applied.
There is no time penalty if the team never submits a correct solution.
While coding programs, teams may use hardcopy references (books, printouts,
notes). But teams may >not use electronics (calculators, PDAs, etc.) or
network references (the Internet, personal home directories).
The winning team is the team with the most points. If there is more than one
team with the most points, then the total time taken to solve the problems is
taken into account. The total time is determined by adding up, for each
problem, the time since the beginning of the contest to the time the correct
solution was submitted, plus any 20 minute penalties for incorrect solutions.
The winning team is then the team with the least total time.
Tips
Please also note the excellent comment
by Thomee Wright on this matter.
- Do the easiest problems first. Scoring is based first on number of
problems solved, and then the total time taken. - Read through all the problems before you start programming.
That way you'll have an idea of which problems are easy and which
problems are hard. - Make sure your output's format matches the specified format
exactly. Incorrect formatting is the most common error for
new teams. - Use the simplest algorithm that does the job. Your only goal is to
come up with a correct solution. With most contest problems, memory
efficiency and run-time efficiency are not an issue. - Think through your solutions before you begin to program. You don't
want to waste time programming an inherently incorrect solution. - Program carefully, not quickly. You want to minimize the time to get
a correct solution. If you program as fast as you can type, you'll
spend most of your time debugging. You may want to have one team member
type and another team member watching for bugs. - Enable compiler warnings (e.g. use the
-Wall
flag with gcc and g++), so that you can catch errors like
uninitialized variables. - Bring books and printed example code. Take advantage of hard copy
references. - Program on paper while the rest of your team codes on the computer.
Bring paper and pencils. - Some programming contests require you to read input from a file and
write output to a file. If you're using C, learn to use
FILE *freopen (const char *path, const char *mode, FILE *stream).
That way, you can useprintfinstead offprintf
andscanfinstead offscanf.
Program Templates
Most contests will require you to put your team identification and problem
number at the top and bottom of your output, and some contests, such as NMT's
and the ACM regional contests, will require that you read your input and
write your output to files. Because these are repetitive tasks among all of
your programs, you can save time by using a template source file.
Debuggers
A debugger is a program suite which helps you debug code. It can give you call
sequences, you can set breakpoints (to stop execution and look at memory e.g.),
and a number of other useful things. The GNU Debugger is a good one for the UNIX
environment. Proficiency with it is highly valuable.

