Main / Rules

The USC Programming Contest is an event organized once per semester for undergraduate and beginning graduate students. It is a programming contest for individual participants. This page explains the rules of the contest, which are adapted from the rules of the ACM International Collegiate Programming Contest.


Competitors must be students at USC. Competitors must work alone. Competitors will have approximately four hours to complete four to six programming problems. They will write programs to compute the solutions and give the programs or solutions to the judges for evaluation. The decision of the head judge is final in all matters.

All programs are text based. Programs must read input from a designated input file with a given filename and write output to stdout.

Both input and output format are crucial. Adhere to them precisely to avoid getting solutions judged as wrong.

Programs will be written in C, C++ or Java. All programs must execute in less than one minute. Any program taking longer than this time limit will be terminated and judged incorrect.

Competitors may bring and use any written reference material they desire. They may not use any electronic aids, including calculators. The on-line help in the compilers may be used, but no web browser may be used, neither for local nor for other sites. Competitors may not start external sessions (ssh, ftp, or others) for any reason.

Competitors should not log out of their computer for the duration of the contest.

Submission Procedures

Competitors will submit their programs or output data using PC^2.

Solutions must be named according to the given file names, and their extension must be ".cpp" or ".java". The same holds for the input file names.

Competitors will receive notice from the judges, indicating whether or not the program functioned correctly. If it did not function correctly, they will be given exactly one of the following error messages:

  • "Program did not compile": This means that the program did not compile. If you use the PC^2 feature "Test run" before you submit, this should never happen.
  • "Wrong file name": This means that you did not follow the submission naming convention.
  • "Run-time error": This means that your program compiled, but crashed or threw an exception when running.
  • "Run time limit exceeded": Programs are terminated after 1 minute.
  • "Incorrect output": This means that your program ran to completion within the allowed time, but produced the wrong output.
  • "Incorrect output format": This means that your answer might have been fundamentally correct, but was formatted incorrectly. Formatting is very important because of the automation used by the judges. You might receive this message if your output is otherwise correct, but also if it isn't.

The judges will give whichever error message they notice first.

Clarification Procedures

Competitors will submit their clarification requests using PC^2.

The problems are not intended to contain any misleading information or to purposefully disguise any special cases. If you still want to ask for a clarification, use PC^2 to do so.

The judges will respond to all requests for clarification. However, the judges may respond with "Read the problem statement." If a question needs to be clarified during the contest, the judges will make a general announcement.


The winner is the competitor who completes the greatest number of problems. Ties are broken according to least total time. Here, the total time is the sum over all problems of the times at which the participant submitted the problems correctly, plus additional penalty time for incorrect submissions. If a participant submitted a problem correctly several times, the first time will be counted.

Each incorrect submission for a problem that the competitor eventually gets correct will penalize him or her by adding 20 minutes to his or her total time. Incorrect solutions to problems which are never answered correctly do not add to the total time, neither do incorrect solutions submitted after correct solutions.

Example 1: Competitor 1 submits Problem A incorrectly after 40 minutes, and correctly after 46 minutes. Also, he submits problem B correctly after 72 minutes, and incorrectly after 74 minutes. Then, his total time is 46 + 20 + 72 = 138 minutes.

Example 2: Competitor 2 submits problem B incorrectly after 7 minutes, and correcly after 18 minutes. She then submits Problem A incorrectly after 70 minutes, and correctly after 77 minutes. Her total time is 18 + 20 + 77 + 20 = 135 minutes, even though she finished later than competitor 1 and had more incorrect submissions. It pays to solve small and easy problems first.


Correct solutions to all problems which were answered correctly by at least one contestant will be posted on the web. By participating in the contest, all contestants give the head judge permission to post their solution as the correct solution on the web. Proper credit will be given.

The USC Programming Contests are organized by David Kempe, Sven Koenig, Suya You, and Upsilon Pi Epsilon of the Computer Science Department of USC. Please contact David Kempe (dkempe AT with any questions.