Materials (and Devices)

Only printed reference materials are allowed. No electronic devices which may store or access other resources are permitted in the contest area. In short, electronic storage, the internet and cell networks will not be available during the contest. However, Javadocs 1.6 and C/C++ reference will be available to you on your workstations.


Teams are ranked according to the most problems solved. For the purpose of breaking the tie, teams that solve the same number of problems are ranked by least total time. The total time is defined as the sum of the time consumed for each problem solved. The time consumed for a problem solved is defined as the time elapsed from the beginning of the contest to the submittal of the accepted run plus 20 penalty mimutes for every rejected run for that problem regardless of submittal time. There is no time consumed for a problem that is not solved.

In the case of further ties for least total time, teams will have the same rank and receive the same award. Let us consider an example of total time. Suppose the contest begins at 10. Team A submits the accepted run the first time at 11 for one problem. The time consumed for this problem is 60 minutes. Team A submits the rejected run at 11:30 and 11:45 before submitting the accepted run for another problem at 12. The time consumed for this problem is 120+20+20 = 160 minutes. If team A does not have any additional problem accepted for the contest and has many rejected submissions, the team A solves 2 problems with total time of 60+160=220 minutes.

Code writing

You may use any stand-alone editor available on the contest machine to write code. You may not use an Integrated Development Environment (such as BlueJay or Eclipse or Netbeans).

Naming your solutions

There are eight problems for you to solve. If you are programming in Java, name your programs:
... should be the solution for problem 1, should

be the solution for problem 2, and so on. If you are programming in C++, name your programs:


If you are programming in C, name your programs:


Compiling programs

In your home directory, there are three files named, problem0.cpp, and problem0.c. You should read the problem0 description and study the solution provided with respect to how input and output are being done, since problem0 has the similar input and output structures as the other contest problems. You should also practice compiling and running the version written in your language of choice. Type the command…


…in a terminal window to see the files currently in your home directory. To compile the Java program (choose either window), enter the command


To run the Java program, enter the command (after compiling):

java Main < problem0_in > problem0_out

The above line uses input and output redirection.

The content of the file problem0_in is:

6 9

1 2 3 4 5

10 10 10

The content of the file problem0_out is:



30 the terminal window. To compile the C++ program, enter the command:

g++ -o problem0 -Wall problem0.cpp

To compile the C program, enter the command:

gcc -o problem0 -Wall problem0.c

The "-o problem0" tells the compiler to name the executable program problem0. To run both the C++ program and the C program (after compiling) enter the command:

./problem0 < problem0_in > problem0_out

As with the Java program, you should see problem0_out containing:




Note that if the focus is on a terminal window (left click on a terminal window to focus on it), the up and down arrows can be used to move through the commands you have previously typed. To rerun a previous command, find it with the arrow keys (up moves backwards and down moves forward) and then press Enter.

If you accidently close a terminal window, just single click on the terminal icon in the upper right hand corner of your screen.

Editing programs

In the other terminal window, begin editing your solutions. To begin editing, for example, enter the command:


This will create the file if it doesn’t exist or edit the existing file if it does. Remember to save your program before you compile and run it in the other window.

The gvim editor has been aliased to run in easy mode (always in insert mode). To run it in with its normal bi-modal behavior (edit and insert modes), run the command


The commands for creating and editing C++ and C programs are similar.

Remember, you can also use emacs, vim, nano, or gedit if you so wish.

Submitting your program

You will use PC^2 to submit your program. Instructions for how to use PC^2 are available here. If you have problems using PC^2 during the contest, please alert contest staff.

You will receive email containing the testing results. It is possible to cut and paste from the email client to your gvim editing session.