Contest Environment Description
Input and Output Specifications
The following represents the normal restrictions to input and output. If exceptions are to be made, they will be explicitly stated in the Input or Output sections of the problem descriptions.
- All input will be read from standard input. The data on each line will be separated by a single space. There will be no white space at the beginning or at the end of a line. Blank lines will contain no characters. Tabs will never be used. Note that lines may contain more than 80 characters (not including "newline" characters). It should be obvious what the maximum length of the input lines can be for each problem.
- You may assume that all input data will conform to the input specifications of the problem; we will not try to trip you up by giving you bogus input.
- All output goes to standard output. There should be no additional white space at the beginning or the end of any line. Blank lines should contain no characters. The last line of output should not be a blank line. This means that when requested to "separate items with single spaces" you should not simply follow each item on a line with a space, as that will result in an extra space at the end of the line. Likewise, when requested to "separate output for each problem instance with a blank line" you should not output a blank line after the output of each problem instance.
- You will NEVER need to open a file for input or output.
Judges' Responses
Each submission will receive one of the following responses. The first one that the judges notice will be issued.
NO - Compilation Error
NO - Run-time Error
NO - Time limit exceeded
NO - Wrong Answer
NO - Presentation error
NO - Other - Contact Staff
YES - Correct Answer
"NO - Compilation error" means that your program did not compile.
"NO - Run-time error" means that your program crashed when run on judges' data
"NO - Time limit exceeded" means your program did not terminate after a predefined amount of CPU time. The CPU time limits will be stated on the problem set. Note: the time limits on the contestant machines may not correspond to those on the judging machines because of differences in processor speed.
"NO - Wrong answer" means at least one calculated result for at least one problem instance was incorrect. Even if you are correct on 99 problem instances but are wrong on the last one, you will get this response.
"NO - Presentation error" means the data that you were required to calculate were correct, but the display included letters in the wrong case (e.g. upper instead of lower case), extra or missing spaces (including extra space at the end of a line), extra or missing blank lines (including extra blank lines at the end of your output), misspellings and missing or extra symbols or punctuation.
"NO - Other - Contact staff" is used for an incorrect submission when the judges wish to tell you more information about your submission. For example, perhaps you submitted the solution of problem E for problem F. Upon receiving this response, the contestant should come to the judges room immediately.
"YES - Correct Answer" means that your program gave the correct output on all test cases, so you can start celebrating! (but not for too long - there are still other problems!)
Logging in
When you arrive at your assigned workstation, you should be presented with a PC^2 log in screen shown below. Enter your team ID and password to log in (both will be provided to you by contest officials).
Note: If you exit PC^2, you will need to restart PC^2 again and log in. If you did not properly log out, you will not be allowed to log in. If this happens, please inform a proctor.
Once you log in, you will see a screen similar to the one below. This is your main PC^2 screen which allows you to both test your programs and submit your programs to be judged.
For our contest, the only features that you will be using are the following:
- Select a Problem – select the problem which your code will attempt to solve
- Select a Language – either C++ or Java
- Select – allows you to specify the program to be either tested or submitted to solve the selected problem
- Test – used to test your program (see section below on Compiling and Testing Your Programs)
- Submit – used to send your program to the judges (see section below on Submitting Your Programs)
- Exit – exit out of the PC^2 environment. You should ONLY use this button when the contest is over.
Environment
The underlying operating system running the contest is Linux. A Linux window will be open on your screen when the contest starts. The major reason you will need this window is to get printouts of your code (or perhaps to restart your editor in case you accidentally kill it - see the next section on Editing Your Programs). Files can be printed by using the "lpr" command. Type:
lpr file
to print file. Here is a list of the other basic Linux utilities that you may want to use:
- cp file1 file2 – copy file1 to file 2
- rm file – remove file
- mv file1 file2 – rename (move) file1 to file2
- less file – print file to the terminal screen
- ls – list files in your directory
If you need to do any other actions, please ask one of the proctors for help.
Editing Your Programs
Four editors are provided for editing your program files. The simplest is gedit, which behaves similarly to most word processors you are familiar with (e.g. Word). If you are familiar with pico, vi or xemacs, these editors are available as well. You may start the provided editors by typing “gedit”, “pico”, “vi” or “xemacs” from the command line in the terminal window. NOTE: At the start of the contest, gedit will already be up and running.
Your program source and input files should be named in the following way:
Language |
Source Name |
Input Name |
C++ |
probXY.cpp |
X.in |
Java |
probXY.java |
X.in |
where "X" is the problem letter you are trying to solve and "Y" is your team. The scripts executed by the "Test" button in PC^2 assume that you have used these file names. Your submission should not include more than one file. If you are using Java, this means putting all class definitions in one file (recall that this can be done as long as only one is defined as public).
For example, if you are team 6 and are working on problem C, then your program source should be in probC6.cpp, or probC6.java, and your input file should be C.in.
Compiling and Testing Your Programs
To compile and test your programs, select the problem, language, and program source file in the PC^2 window and click on the "Test" button. The source code is compiled using the same compiler settings used by the judges to judge your programs. If the compilation is successful, your program is then executed on each of the input files in your home directory, and the output is displayed in a new editor window on your screen. Exit this window when you are done (press "q"). Your program will be killed automatically if it uses too much CPU time.
You can compile and test your program outside of the PC^2 environment, but it is not recommended, since the “Test” button is what the judges use to test your program. If you wish to do this, please ask the proctors for assistance.
Submitting Your Programs
To submit your program, select the problem, language, and the program source file (do not submit your executable!) in the PC^2 window and click on the "Submit" button. It is recommended that you click on the "Test" button and make sure that your program works as expected before trying to submit.
Example
Suppose that you are Team 8 solving the following problem (real problem descriptions will be more detailed and probably a little harder):
Problem A: Add 1
Write a program that reads input integers and adds 1 to every integer. Every line of input contains one integer, and the output should contain the same number of lines, in which the integer is one more than the corresponding input integer. The end of input is indicated by a line containing only 0 and should not be processed.
Sample Input
1
2
3
0
Sample Output
2
3
4
Step 1: Edit your program
If you are using C++, you should enter the following program and save it as probA8.cpp:
#include <iostream.h>
using namespace std;
int main(void)
{
int n;
cin >> n;
while (n != 0) {
cout << n+1 << endl;
cin >> n;
}
return 0;
}
If you are using Java, you should enter the following program and save it as probA8.java:
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n;
n = in.nextInt();
while (n != 0) {
System.out.println(n+1);
n = in.nextInt();
}
}
}
Step 2: Edit your input file
You should save the input file under the names A.in. For example, you may want to enter the following into A.in:
1
2
3
0
Step 3: Test your program
In the PC^2 window, select the problem and the language you choose, as well as the program source file. Click the "Test" button. The program is compiled, and if there are no errors, the program is run on the supplied input files. The result is displayed in a new editor window. Quit the editor window when you are done.
You may wish to experiment and see what happens when your program does not compile, or when your program causes run-time errors. (for example, by dividing by 0 or by doing an extra integer read after the while loop).
Step 4: Submit your program
In the PC^2 window, select the problem and the language you choose, as well as the program source file. Click the "Submit" button.