British Informatics Olympiad: Format

The British Informatics Olympiad is the national computing competition for schools and colleges.

There are lots of excellent reasons for entering an Olympiad, here are three to get you going:

  • Every time you program you become a little bit better at programming
  • Solving new problems encourages new ways of thinking.
  • You may be the best in your school, you get to compete with people who may be as good as if not better than you

The following guide to answering Olympiad questions was originally put together to help my own students.  I’ve shared it here in the hope you’ll find it useful.


Olympiad Format

In the Olympiad, as with any examination, you should make sure you’ve looked at past papers and understood how you will be tested.

The first stage of the BIO is a three-hour exam, taken at school, in which students solve problems with the aid of a computer. These are marked by a teacher and submitted for moderation.

It’s important to understand just how these problems are marked.  The vast majority of marks are awarded for output from your program.  Unlike the usual sort of exams you might be familiar with, you don’t get many marks for method or elegance.  In the Olympiad, nearly all the marks are based on results.  Your teacher is given a set of test data to enter into your program, they award marks based on the program’s output.   One of the challenges is to ensure that your program considers all possible inputs.

Here’s a worked example to illustrate this, based on a past Olympiad question:

Example: Time in Words

Given a time in numbers we can convert it into words. For example:

5:00 Five o’clock
5:10 Ten minutes past five
5:15 Quarter past five
5:30 Half past five
5:45 Quarter to six
5:47 Thirteen minutes to six
Write a program which inputs two numbers (the first between 1 and 12, the second between 0 and 59 inclusive) and then prints out the time they represent, in words. You should follow the format of the examples above. Your program should then terminate.
Sample run
Hours: 4
Minutes: 12
Twelve minutes past four

First Attempt

As a first attempt, you might write a partial solution to the problem such as  the following Java example

String [] times = {"o'clock","One","two","three","four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",              "quarter", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty one", "twenty two", "twenty three", "twenty four", "twenty five","twenty six","twenty seven","twenty eight", "twenty nine","Half past"};
int hours = 4;
int minutes = 12;
if (minutes>30)
{
     System.out.println(times[60-minutes]+ " minutes to " + times[hours]);
}
else
{
       System.out.println(times[minutes] + " minutes past " + times[hours]);
}

Running the program with the sample data (4 hours 12 Minutes) produces the correct result.  But does it work for all cases?

Refining

You should now try the examples given at the start of the question.  If you do, you’ll notice that the program prints out such things as “Quarter minutes past five”

Clearly, you’ll need to modify the program to take these cases into account.

Once you’ve done that, you’ve solved the problem…

… or have you?  Whilst there are no “trick” questions in the BIO, you are expected to think like a programmer.  Have you considered all of the possible cases?  Are you sure that you have covered all the possible test data that will be contained in the mark scheme?

You might want to have a go at writing the program yourself.  When you’ve done so, check if your program gives the right answers when you enter the following data.  Did you consider all the possibilities?

Time in Words: Test Data

  1. 6:25
  2. 7:45
  3. 12:00 (noon)
  4. 0:00 (midnight)
  5. 12:55
  6. 0:05
  7. 0:30
  8. 0:52

If you’ve worked through the above you should have a good idea how to go about answering the Olympiad.  But what happens when you encounter a particularly difficult problem?  Follow this link to find out about breaking down problems

1 Comment

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s