What is it?

The UVa Online Judge hosts thousands of programming challenges.

It also has an "automated judge". You can submit your solution in c, c++, java, or pascal and get quick feedback on whether it works or not.

How do I use it?

Best to learn by example. A tutorial on using the UVa judge is found below.

Warning: the site is currently having issues with cookies. You may get a "redirect loop" error or something else.

Suggestion: use your browser's incognito mode.

  1. Register and log in

  2. Pick a problem

    Use the Browse Problems link on the left menu. A good place to start is with the Competitive Programming 3: The New Lower Bound of Programming Contest (Steven & Falix Halim) link. This lists a variety of problems organized by type. Good beginner problems are listed first under the Introduction heading.

    For this tutorial, we will pick an extremely simple problem. Don't worry, most problems are far more interesting. From the Browse Problems link, choose Contest Volumes (10000...), then Volume 111 (11100-11199), then 11172 - Relational Operator.

    You should have seen the following just before you clicked on the problem.

    UVa Problem Data

    The first column after the problem name indicates the total number of submissions and the number of successful submissions. The second indicates the number of users who have attempted the problem at least once, and how many of them eventually got it accepted.

  3. Read and Understand the Problem Statement

    Read it carefully, don't skim any part.

    The data that the judge will test your solution on probably explores "corner cases"; instances that are close to the boundaries of the input data.

    In the case of Relational Operator, there aren't really any tricks. In other problems, it might be helpful to go over the list of common mistakes and traps in programming challenges.

  4. Design and Implement an Algorithm

    You should write your program to read the input data from standard input and print the result to standard output (e.g. cin and cout in c++).

    The following c++ code solves this problem:

    #include <iostream>
            
    using namespace std;
    
    int main() {
       int t;
       cin >> t;
             
       for (int i = 0; i < t; ++i) {
          int a, b;
          cin >> a >> b;
          if (a < b) cout << '<' << endl;
          else if (a > b) cout << '>' << endl;
          else cout << '=' << endl;
       }
    
       return 0;
    }
    

  5. Compile and Test

    If you are using Linux or OS X, you can compile from a terminal via

    g++ p11172.cpp -o p11172 -O2 -Wall
    This assumes you called the source code file p11172.cpp. The -O2 flag tells the compiler to spend some time optimizing the executable to run a bit faster and -Wall will display all warnings.

    To get g++ working on OS X you will probably need to install Xcode and its command line tools.

    To test, I suggest creating your own plain text file with the sample input given in the problem description. Say it is called sample.in. You can then text your program by feeding it this sample input via

    ./p11172 < sample.in

    If your sample.in contained the sample input, the output should be

    <
    >
    =

  6. Submit!

    If you think it works, it is time to submit. There are two options: 1) click the submit icon on the problem description page or 2) use the "Quick Submit" link on the left of the page (only visible if you are logged in).

    Make sure you select the correct programming language. You can either include your code using the upload button at the bottom or you can just copy/paste it into the big text box. If you are using "Quick Submit", you should also enter the problem number in the top box. In this case, it is 11172.

    Click the "Submit" button!

    Check the outcome using either the "My Submissions" link or link "My uHunt with Virtual Contest Service" link on the left of the screen.

    Common Verdicts

    • Accepted - You got it, now solve another!
    • Wrong answer - Your output was not what the judge was expecting.
    • Runtime error - It crashed. List of common mistakes.
    • Time limit exceeded - It took too long. Is your algorithm fast enough? Do you have an infinite loop?
    • Presentation error - The output data seems correct, but the whitespaces are not correct (too many/few spaces?).