100% found this document useful (1 vote)
796 views350 pages

Kunci Jawaban Merged

The document is a solutions guide for the 2022 Round 1 of the Bebras Australia Computational Thinking Challenge. It provides the questions, answers, explanations, associated computational thinking skills, and relevant Australian Digital Technologies curriculum concepts for the challenge. The challenge had 481 Australian schools and 27,435 students participate in Round 1 2022, and aims to promote computational thinking skills in students.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
796 views350 pages

Kunci Jawaban Merged

The document is a solutions guide for the 2022 Round 1 of the Bebras Australia Computational Thinking Challenge. It provides the questions, answers, explanations, associated computational thinking skills, and relevant Australian Digital Technologies curriculum concepts for the challenge. The challenge had 481 Australian schools and 27,435 students participate in Round 1 2022, and aims to promote computational thinking skills in students.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 350

Bebras Australia

Computational
Thinking Challenge
2022 Solutions Guide
Round 1

Primary School
Grades 3–6 bebras.edu.au
Bebras Australia
Computational Thinking
Challenge
Bebras is an international initiative aiming The Bebras international community has now
to promote Computational Thinking skills grown to 60 countries with over 2.9 million
among students. ​ students participating worldwide!

Started in 2004 by Professor Valentina ​ ebras Australia began in 2014 and is now
B
Dagiene from the University of Vilnius, administered through CSIRO Digital Careers.
‘Bebras’ is Lithuanian for beaver. This refers
to their collaborative nature and strong In Australia, the Bebras Challenge takes place
work ethic. in March and August–September each year.
As of 2020, two separate challenges are
The International Bebras Committee meets offered for each round.
annually to assess potential questions and
share resources.​Questions are submitted To find out more and register for the
by member countries and undergo a next challenge, visit bebras.edu.au
vetting process.

Engaging young
481
minds for Australian schools

Australia’s
participated in
Round 1 2022

digital future 27,435


Australian students
participated in
Round 1 2022

CSIRO Digital Careers supports teachers and encourages students’ 2.9 million
understanding of digital technologies and the foundational skills Students participate
they require in an ever-changing workforce. Growing demand worldwide
for digital skills isn’t just limited to the ICT sector. All jobs of the
future will require them, from marketing and multimedia through
to agriculture, finance and health. Digital Careers prepares
students with the knowledge and skills they need to thrive in the
workforce of tomorrow.

csiro.au/digital-careers
2
What is a
Solutions Guide?
Computational Thinking skills underpin the careers of the future. Creating opportunities
for students to engage in activities that utilise their critical and creative thinking along with
problem solving skills is essential to further learning. The Bebras Challenge is an engaging way
for students to learn and practice these skills.

Within this Solutions Guide you will find all of the questions and tasks from Round 1 of the
Bebras Australia Computational Thinking Challenge 2022. On each page above the question
you will find the age group, level of difficulty, country of origin and key Computational
Thinking skills.

After each question you will find the answer, an explanation, the Computational Thinking
skills most commonly used, and the Australian Digital Technologies curriculum key
concepts featured.

3
Contents
What is a Solutions Guide? 3
What is Computational Thinking? 5
Computational Thinking skills alignment 6
Australian Digital Technologies curriculum key concepts 7
Digital Technologies key concepts alignment 8
Years 3+4 9
Football Uniform 10
Coin Triangle 11
Dancing Doll 12
Stamping 13
Bridge Builder 14
Go to the Market 16
Orange Juice 17
Dentist 18
Coin Bag 20
Necklaces 22
Moving Balls 23
Do they Meet? 25
Tortoise Path 28
Preferences 30
Beaver Farmer 32
Years 5+6 34
Strange Sorting 35
The Lost Gold Bar 36
Picking Up Carrots 37
Counting Out 38
Looking in a Mirror 40
Science Fair 41
Forest Watch 43
Mission Possible 45
Choices 46
Maze 48
Crested Birds 49
Strawberry Thief 51
The Present 53
Tree Pruning 55
Elephants in the Fridge 57

4
What is
Computational
Thinking?
Computational Thinking is a set of skills that underpin learning within the Digital Technologies
classroom. These skills allow students to engage with processes, techniques and digital
systems to create improved solutions to address specific problems, opportunities or needs.
Computational Thinking uses a number of skills, including:

DECOMPOSITION
Breaking down problems into smaller, easier parts.

PATTERN RECOGNITION
Using patterns in information to solve problems.

ABSTRACTION
Finding information that is useful and taking away any information
that is unhelpful.

MODELLING AND SIMULATION


Trying out different solutions or tracing the path of information to
solve problems.

ALGORITHMS
Creating a set of instructions for solving a problem or completing
a task

EVALUATION
Assessing a solution to a problem and using that information again
on new problems.

More Computational
Thinking resources
Visit digitalcareers.csiro.au/CTIA to download the Computational
Thinking in Action worksheets. These can be used as discussion
prompts, extension activities or a framework to build a
class project.
Each resource was designed to develop teamwork; critical and creative thinking;
problem solving; and Computational Thinking skills.

5
Computational Thinking
skills alignment
2022 Round 1 Grade Decomposi- Pattern Modelling &
Abstraction Algorithms Evaluation
Questions level tion Recognition Simulation

Years 3+4

Football Uniform Easy

Coin Triangle Easy

Dancing Doll A Easy

Stamping C Easy

Bridge Builder Easy

Go to the Market Medium

Orange Juice Medium

Dentist Medium

Coin Bag Medium

Necklaces Medium

Moving Balls B Hard

Do they Meet? Hard

Tortoise Path Hard

Preferences A Hard

Farmer Beaver Hard

Years 5+6

Strange Sorting Easy

The Lost Gold Bar Easy

Picking up Carrots A Easy

Counting Out A Easy

Looking in a Mirror Easy

Science Fair Medium

Forest Watch Medium

Mission Possible Medium

Choices B Medium

Maze Medium

Crested Birds Hard

Strawberry Thief C Hard

The Present Hard

Tree Pruning Hard

Elephants in the Fridge Hard

6
Australian
Digital Technologies
curriculum key concepts
Abstraction
Hiding details of an idea, problem or solution that are not relevant, to focus on a manageable
number of aspects.
Data Collection
Numerical, categorical, or structured values collected or calculated to create information, e.g.
the Census.
Data Representation
How data is represented and structured symbolically for storage and communication, by
people and in digital systems.
Data Interpretation
The process of extracting meaning from data. Methods include modelling, statistical analysis,
and visualisation.
Specification
Defining a problem precisely and clearly, identifying the requirements, and breaking it down
into manageable pieces.
Algorithms
The precise sequence of steps and decisions needed to solve a problem. They often involve
iterative (repeated) processes.
Implementation
The automation of an algorithm, typically by writing a computer program (coding) or using
appropriate software.
Digital Systems
A system that processes data in binary, made up of hardware, controlled by software, and
connected to form networks.
Interactions
Human-Human Interactions: How users use digital systems to communicate and collaborate.
Human-Computer Interactions: How users experience and interface with digital systems.
Impact
Analysing and predicting how existing and created systems meet needs, affect people, and
change society and the world.

For more information on the Digital Technologies curriculum, please visit the
Australian Curriculum, Assessment and Reporting Authority (ACARA) website:
australiancurriculum.edu.au/f-10-curriculum/technologies/digital-technologies
7
Digital Technologies
key concepts alignment
Data Data Imple-
2022 Round 1 Grade Abstrac- Data Specifica- Algo- Digital Interac-
Represen- Interpre- menta- Impacts
Questions level tion Collection tion rithms Systems tions
tation tation tion

Years 3+4
Football
Easy
Uniform

Coin Triangle Easy

Dancing Doll A Easy

Stamping C Easy

Bridge Builder Easy

Go to the
Medium
Market

Orange Juice Medium

Dentist Medium

Coin Bag Medium

Necklaces Medium

Moving Balls B Hard

Do they Meet? Hard

Tortoise Path Hard

Preferences A Hard

Farmer Beaver Hard

Years 5+6

Strange Sorting Easy

The Lost Gold


Easy
Bar
Picking up
Easy
Carrots A

Counting Out A Easy

Looking in a
Easy
Mirror

Science Fair Medium

Forest Watch Medium

Mission Possible Medium

Choices B Medium

Maze Medium

Crested Birds Hard

Strawberry
Hard
Thief C

The Present Hard

Tree Pruning Hard

Elephants in the
Hard
Fridge
8
Bebras Challenge
2022 Round 1

Years 3+4
This question comes from Years 3+4 Easy
Ireland Years 5+6
Years 7+8

Football Uniform
Years 9+10
Years 11+12

Anne is packing her bag for a football match. She needs to pack the shirt which does not have stripes
and does not have black sleeves. It must have a black collar.

Question
Which shirt should Anne pack?

Answer
The correct answer is shirt B.

Explanation
Shirt A is not correct because it has black sleeves.
Shirt B is correct because it does not have black sleeves, it does have a black collar, and does not have
stripes.
Shirt C is not correct because it has stripes.

Shirt D is not correct because it has black sleeves.

BACKGROUND INFORMATION
In this task, one condition has to be true (black collar) and two conditions have to be false (stripes and
black sleeves). Understanding conditions is very important in computer programming. All computer
programming languages have conditions. Conditions can be used to tell which parts of a computer
program should be run next (an “if” statement) and some conditions can be used to tell which objects
should be included in, or left out of, lists of objects (a list comprehension).

This task can be used to introduce the logical Boolean operators AND and NOT.

In the field of machine learning, classification is the concept of a computer program learning to group
objects together based on their features. For example, the machine learning computer program might
be given lots of examples of football shirts and it would figure out what combination of conditions
(collar, sleeves, stripes, stars, colour, length, crest) are best to separate two shirt types.

10
This question comes from Years 3+4 Easy
Czechia Years 5+6
Years 7+8

Coin Triangle
Years 9+10
Years 11+12

Emily has six coins:

She put the coins on top of each other to make a triangle shape.

Question
Which was the fourth coin Emily put down?

EXPLANATION

Answer

Explanation Each coin overlaps at least one other, so you can start by
finding the coin that is not on top of any others. This is the
top one in the triangle, and must have been put down first.
The next coin to be placed can only be above the starting
coin. By working our way around in this way, we can find the
fourth coin to be placed.

BACKGROUND INFORMATION
The coins in the picture are laid in a sequence.
You can see the same effect if you’re drawing a picture on a computer. If you draw a
yellow circle, then two dots, and then a curved line, you get a smiley face. If you had
drawn the yellow circle last, the two dots and curved line would have been hidden
behind the circle.

Computers usually work sequentially. Most computer programs are written so that first action and then
another action happens. So a computer program for drawing a smiley face could look like this:
draw circle at (5,5) with radius 5
draw dot at (2,7)
draw dot at (7,7)
draw left curved line from (2,2) to (7,2)
Of course, sequences are not all that computers can do. In order to program more complex programs, a
computer needs to be able to make decisions and perform repetitions.
11
This question comes from Years 3+4 Easy
India Years 5+6
Years 7+8

Dancing Doll
Years 9+10
Years 11+12

A dressmaker was asked to make dresses for four dolls. Each dress should be made from four different
patterned materials.

Question
Which doll is wearing a dress that is NOT made from four different patterns?

Answer
Which doll is wearing a dress that is NOT made from four different patterns?

Explanation
The dress being worn by this doll is made from only three different patterned fabrics. The others are
made from four.

BACKGROUND INFORMATION
Data can take the form of images, numbers or text.
In this task, the four materials form the data structure. The students are asked to do a data verification
process to check that the required rules, about how many different coloured patterns have to be used,
are correct in each case.

12
This question comes from Years 3+4 Easy
Hungary Years 5+6
Years 7+8

Stamping
Years 9+10
Years 11+12

Casey has four stamps which make four different pictures.


Casey picks up each stamp just once and uses it to stamp twice. This is what Casey has made:

Question
Which stamp did Casey use first?

EXPLANATION
Answer

Explanation
The sun is “under” the leaf so it must have been stamped before the leaf. The leaf is underneath the
flower and the house, so the sun must have been stamped first.

BACKGROUND INFORMATION
There are a lot of computer programs and apps where you can draw or manipulate pictures. Most of
them use layers. With layers you can define the order of image-parts. The pictures on the bottom layer
will be overlapped by the pictures on other layers. Of course, the layers can be different sizes and they
can also have transparent backgrounds.
In an animation, where you use frames (pictures) after each other, the bottom layer can contain the
background – and it can be copied to the next frame. You can manipulate the layers separately so it is
easier to modify, copy or delete a smaller part of the picture.

13
This question comes from Years 3+4 Easy
Czechia Years 5+6
Years 7+8

Bridge Builder
Years 9+10
Years 11+12

Bella has a new building project! She needs: a hammer, nails, wooden boards and a rope.

She already has a hammer and a rope: So she needs to buy some nails
and wooden boards:

There are three shops in the village where Bella can get these things, but she wants to visit as few
shops as possible.

Question
Which of the shops does Bella need to visit?

EXPLANATION
Answer

Continued on next page


14
This question comes from Years 3+4 Easy
Czechia Years 5+6
Years 7+8

Bridge Builder– continued


Years 9+10
Years 11+12

Explanation:
The missing items are shown below

BACKGROUND INFORMATION
This simple problem shows how a big application (the village) may offer a lot of resources (procedures),
but these resources are organised into smaller groups called microservices. When a process (Bella)
needs some procedures in its logic, it doesn’t have to implement them itself (Bella doesn’t need to craft
her own items), but it requests them from other services (in this case, Bella buys the resources from
other stores).
This problem asks for the stores on which Bella depends. When writing more complex programs, it is
good practice to check which services a process depends on so that when something doesn’t work all
affected processes can be traced to their root cause.

15
This question comes from Years 3+4 Easy
Indonesia Years 5+6
Years 7+8

Go to the Market
Years 9+10
Years 11+12

Anushka, Barnie and Chloe are planning a party for their family. They need to buy all the items
shown below.
Each beaver can only carry two baskets:
- Anushka can carry 8kg in total.
- Barnie and Chloe can each carry 5kg in total.

All the food must be carried home in a single trip.

Question
Which items should each beaver carry? Drag the items to their baskets.

EXPLANATION
One possible answer

Explanation
There are actually quite a few possible answers, but the beaver that can carry 8kg must carry the 5kg
package and one of the 3kg foods.
This leaves the other two beavers that can carry 5kg. They must both carry one 2kg and one 3kg item.

BACKGROUND INFORMATION
This task requires students to satisfy some constraints to determine which beavers can carry which
food items. While there are a number of options, there are some important constraints that must be
satisfied.
In a computer system, there are often processes that can only be performed if a given set of constraints
are satisfied.
16
This question comes from Years 3+4 Medium
Uruguay Years 5+6
Years 7+8

Orange Juice
Years 9+10
Years 11+12

The beavers are playing a logic game.


Beaver Kamal can drink from a bottle when:
A) there is a bottle with less juice immediately to the left of this bottle, and
B) there is a bottle with more juice immediately to the right of this bottle.

Question
Click on all the bottles that Kamal can drink from.

EXPLANATION
Answer

Explanation
Only the bottles numbered 4 and 7 meet the given conditions, that is, less juice on the left AND more
juice on the right.

BACKGROUND INFORMATION
Computer Science often involves solving problems that are specified by a set of logical constraints. The
task is to find a solution that satisfies all of these restrictions.
More complex tasks can be considered where the constraints are combined by logical operators, for
example:
- A AND B means that both constraints A and B must be satisfied, as in this task;
- A OR B means satisfying only one of them is sufficient.
The process that the beavers are running here has close ties to scheduling, that is, a method of deciding
how the bottles are chosen.
17
This question comes from Years 3+4 Medium
Croatia Years 5+6
Years 7+8

Dentist
Years 9+10
Years 11+12

Beaver Ruth is heading home from school but first she must go to the dentist.
To make the journey more fun, she plays a game.

Game rules:
Ruth can only move straight ahead, from one square to
another.
Instead of moving forward she can turn right.
She can follow rules 1 and 2 as many times as she wants,
and in any order.
She must NOT go diagonally.

Question
Is it possible to go to the dentist first and then home if Ruth follows her rules?

It is not possible to reach both places in this way

It is possible, if she turns right exactly 2 times

It is possible, if she turns right exactly 4 times

It is possible, if she turns right exactly 6 times

Continued on next page


18
This question comes from Years 3+4 Medium
Croatia Years 5+6
Years 7+8

Dentist – continued
Years 9+10
Years 11+12

EXPLANATION

Answer
It is possible, if she turns right exactly 4 times.

Explanation
The beaver can get to her home after visiting the dentist if she does a combination of movement
conditions (moving straight and right) according to the following picture:

BACKGROUND INFORMATION
One of the main tasks in computer science is to search for possible solutions. These solutions have to
follow certain conditions. The question that is often asked is whether there is at least one possible
solution.
In this task it is necessary to write a program for the movement of the beaver according to the given
conditions, and with certain restrictions. By doing so, it can be confirmed that a solution is indeed
possible.

19
This question comes from Years 3+4 Medium
Ireland Years 5+6
Years 7+8

Coin Bag
Years 9+10
Years 11+12

This is Sam’s bag of coins:

In Sam’s country there are only four types of coins. The image below shows both sides of each
type of coin:

Sam’s bag of coins has been shaken and placed next to three other bags.

Question
Which is Sam’s bag of coins?

EXPLANATION
Answer

Explanation
Sam’s bag has:
- four coins of type one (green/yellow),
- two coins of type two (red/blue),
- one coin of type three (orange), and
- one coin of type four (purple)
Continued on next page
20
This question comes from Years 3+4 Medium
Ireland Years 5+6
Years 7+8

Coin Bag – continued


Years 9+10
Years 11+12

This is illustrated in the table below.

Sam's bag 4 2 1 1

Bag A 3 3 1 1

Bag B 4 1 2 1

Bag C 4 2 1 1

Bag D 2 4 1 1

is not correct because it has three star/sun coins but Sam’s bag has
four star/sun coins.

is not correct because it has two snow coins but Sam’s bag has
only one snow coin.

is correct because it has the correct number of each type of coin.

is not correct because it has three star/sun coins but Sam’s bag has
four star/sun coins.

BACKGROUND INFORMATION
Some of the world’s information (stories, conversations, messages, shopping lists) can have different
lengths and unstructured information. Computer scientists often have to invent a structure, or way of
organising information so that the information can be processed by computer programs. Sometimes,
certain features have to be ignored, and things that look different have to be treated as being the
same. When we organise information in this way we are using the computational thinking skill called
abstraction.
In this task, a bag is used as an example of unstructured data. (The bag has no particular ordering
for its coins and can have multiple coins of the same type.) There are more complicated real-world
examples too. Extracting meaning from human language is one very difficult but important task for
computers that deals with unstructured data. For example, imagine if people were asked “What did
you like best about this movie?” and various people responded with these answers:
“I loved the score”
“The music in this movie”
“The complete audio experience”
“I recognised my favourite song”
A computer program analysing these peoples’ responses would have to recognise that, in this context,
all of these statements should be represented as being the same, even though they all use different
words.
21
This question comes from Years 3+4 Medium
Slovakia Years 5+6
Years 7+8

Necklaces
Years 9+10
Years 11+12

Beavers Anna, Bella and Lena made bracelets to spell out their names.

They used different patterns of just two types of bead for each letter: and .

To separate the letters in the bracelets they used beads.

The finished bracelets:

Anna

Bella

Question
Which bracelet did Lena make?

EXPLANATION

Answer

Explanation
The letter L is in the name BELLA and is the third letter in the bracelet, so it is made of beads

From Bella’s necklace we can also see that E is .

From Anna’s necklace we see that N is and that A is .

BACKGROUND INFORMATION
Computer scientists often have to encode information, mainly to make communication easier, to write
information, or to store it more economically. We can also make secret codes. Here the encoding of
letters is based on the Morse Code, where the dot ( ) of Morse Code is replaced by and the dash
( ) is replaced by .
Therefore, ‘A’ in ANNA’s name is encoded as ( ).
If we don’t know which encoding is used, then we can’t create necklaces for names with other letters.
We would have to agree on how to encode each letter from the alphabet. Computer scientists can also
encode information for pictures, sounds or videos.
22
This question comes from Years 3+4 Hard
South Korea Years 5+6
Years 7+8

Moving Balls
Years 9+10
Years 11+12

Beavers are playing a game. The aim of the game is to move the balls so that the same coloured balls
are in the same tubes.
Game Rules:
• Rule 1: Only one ball can be moved at a time.
• Rule 2: Only balls at the top of a tube can be moved.
• Rule 3: A ball can be moved into an empty tube.
• Rule 4: When there is a space in a tube, a ball can only be moved on a ball of the same colour.

Example:

Question
Drag the balls from tube to tube, obeying the rules of the game, until the same balls are in the
same tubes.

23
This question comes from Years 3+4 Hard
South Korea Years 5+6
Years 7+8

Moving Balls – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
There are various solutions to this task as long as the balls all end up sorted into their own columns,
for example, like this:

Explanation
The desired outcome has to be achieved by making a series of allowed moves. A possible solution and
the moves required to achieve it are shown below:

BACKGROUND INFORMATION
In Computer Science data is often stored in computer memory in stacks. The special characteristic of
stacks is that you can only access and remove the last added data.
The cylinders in our example behave like stacks: You can only add a ball on the top of a cylinder. And
you can only remove the ball from the top. The other balls cannot be accessed.

24
This question comes from Years 3+4 Hard
Lithuania Years 5+6
Years 7+8

Do They Meet?
Years 9+10
Years 11+12

Beavers Liem and Anika would like to meet on one of the lily pads.
They start on different lily pads as you can see below.
The two beavers can only move from one lily pad to the next by following the arrows.

Question
Click on the lily pad where they can meet if they follow the arrows.

EXPLANATION
Answer
The beavers may meet on pad C5.

Continued on next page


25
This question comes from Years 3+4 Hard
Lithuania Years 5+6
Years 7+8

Do They Meet? – continued


Years 9+10
Years 11+12

Explanation
One way to solve this problem is to consider different paths each beaver can take.
At his starting position, Liem has two options: If Liem goes “up”, then he may either run into the dead
end at A3 or get stuck in the loop that begins at B4. If he goes “right” (to B1), he can continue to D3. At
D3 he may either go “left” into a loop that will take him back to D3 eventually, or go “up” which makes
him end up at C5 which is another dead end.
Anushka also has two options at the start. If she goes “down”, she will run into the dead end at G2. If
she goes “up”, she will reach G3. From there she may either run into the G2 dead end again or go “left”
and reach E5 eventually. There she may either go into a loop that will take her back to E5 again or reach
another dead end at C5.
As we already know, Liem may reach C5 as well, so we can see that the beavers may meet at C5. The
picture shows the ways along which both beavers can reach C5.

But this does not yet fully guarantee that the beavers cannot also meet at F4. Another way to think
about this problem is to define all the possible pads that each beaver can get to. The next picture
shows the set of pads that Liem (white) and Anushka (dark grey) may reach by following the arrows in
any possible way. We can see that C5 is the only pad common to both sets.

26
This question comes from Years 3+4 Hard
Lithuania Years 5+6
Years 7+8

Do They Meet? – continued


Years 9+10
Years 11+12

BACKGROUND INFORMATION
Let us take a closer look at how we created this picture:

For each beaver, we followed the arrows. If there was a dead end, or a loop was detected, we went
back to the most recent fork in order to choose another option to proceed. Thus, we followed all
possible ways.
A very similar procedure is often applied by computer scientists when solving difficult problems. The
procedure tries to construct a solution step by step. Often there are several options to choose the next
step. In this case, the procedure will choose one option but keep track of the other options as well.
When it runs into a dead end (a loop in this case is also considered a dead end if it is detected), it
goes back to the most recent choice and tries another option. This algorithmical approach to problem
solving is called backtracking; this name gives a pretty good indication of how the approach works.

27
This question comes from Years 3+4 Hard
Germany Years 5+6
Years 7+8

Tortoise Path
Years 9+10
Years 11+12

Four tortoises live in four different small gardens.


Each garden is divided into grass squares, surrounded by a stoney area. The tortoises cannot cross the
stoney areas but they can move from one grass square to the next, as shown here:

Each tortoise would like to take a perfect feeding path in its garden.
A perfect feeding path is one where the tortoise can move to all the grass
squares, while visiting each grass square only once.

Question
Which one of the four tortoises shown below cannot take a perfect feeding path?

EXPLANATION

Answer
The bottom left garden should be chosen.

28
This question comes from Years 3+4 Hard
Germany Years 5+6
Years 7+8

Tortoise Path – continued


Years 9+10
Years 11+12

Explanation
For each of the gardens a feeding path is shown.
There is no perfect feeding path in the bottom left garden, though. Such a path would have to include
the parts shown above. The tortoise still needs to find a path across the six remaining grass squares,
starting at one end of the shown path and ending at the other, while visiting all six squares exactly
once.
However, there is no such path:
Let the tortoise start on the lower left of the six squares; it is sufficient to consider this case, due to
symmetry. See below all paths the tortoise can take on the six squares, visiting as many squares as
possible, but each square at most once. None of these paths ends at the upper left square.

BACKGROUND INFORMATION
The tortoises want to find a path through their gardens, visiting each grass square exactly once. This
problem is quite well known in computer science as the Hamiltonian path problem. In the 19th century,
Sir William Rowan Hamilton studied a lot of these type of problems and found that some were not
possible for computers to solve!

29
This question comes from Years 3+4 Hard
Germany Years 5+6
Years 7+8

Preferences
Years 9+10
Years 11+12

Three beavers each want a log.


They write down what their first and second choice would be (shown below on the right).
They decide on these rules:
1. We will make sure that we get the highest number of first choices possible.
2. No one should get a stick that isn’t either their first or second choice.

Question
Show which beaver gets which log by drawing a line between the sticks and beavers.

EXPLANATION

Answer

Explanation
We cannot satisfy all first-place preferences, because
two young beavers have the same first-place preference.
The assignment shown above satisfies two first-place
preferences, and one second-place preference. Given
that not all first-place preferences can be given, this is
the best assignment possible.

Continued on next page


30
This question comes from Years 3+4 Hard
Germany Years 5+6
Years 7+8

Preferences – continued
Years 9+10
Years 11+12

BACKGROUND INFORMATION
One algorithm that can be used to solve this problem is to try all methods of distributing gifts and
choose the best one. To do this, six options are considered: some of them will leave some beavers
without gifts and from the remaining options the best one can be chosen. But if there were 10 beavers
and 10 gifts, then there would be more than three million options that would have to be considered -
the above algorithm would no longer be practical for a person to use!
Computer scientists are often faced with the task of correctly organising such options. For example, in
our problem we can first consider only those gifts that the beavers want to receive in the first place. In
the picture below they are marked with red links. It is immediately obvious that the second and third
beavers want to receive the same gift.

Since we can satisfy the preference of only one of these beavers, two options need to be considered:
1) the second beaver receives their second preference, and
2) the second beaver does not receive their second preference.

For each of the cases a picture is shown, in which the gifts that the beavers want to receive in the
second turn are indicated in blue. In the first case, the blue links can be removed from the second
beaver and the second gift since the gift has already been assigned to the second beaver. In the second
case there are still many options but we can do the same, breaking all the options into those in which
the third beaver receives the first gift and those where they do not receive it. By splitting the options
into two parts we will quickly find all possible distributions of gifts so that later we can choose the best
one. This algorithm in computer science is called the divide-and-conquer algorithm.

31
This question comes from Years 3+4 Hard
Turkey Years 5+6
Years 7+8

Beaver Farmer
Years 9+10
Years 11+12

Farmer Mert grows wheat in fields that contain a wheat symbol in the map below.

He also has stony fields where nothing grows, shown by the stones symbol.

To save water, Mert only wants to water the wheat fields. He can block the water channels coming from
the lake at the spots marked with the letters A to J.

The water will only flow downwards towards the fields and will never flow back towards the lake.

Question
Select the letters to block the water from flowing to the empty fields while still letting it flow to the
wheat fields.

EXPLANATION

Answer

32
This question comes from Years 3+4 Hard
Turkey Years 5+6
Years 7+8

Beaver Farmer – continued


Years 9+10
Years 11+12

Explanation
If none of the gates are closed, the water will reach the fields with stones. If more gates than shown
above are closed, then some wheat fields will get no water. If we review all spots we can determine the
optimal choices:
• A must be open to irrigate field 1
• B has to be closed to avoid irrigating field 2. It also brings water to field 3—but this field can also get
water through C
• C must be open both for field 4 and for field 3, which cannot be watered though A since B is closed
• D must be open for fields 7 and 8
• E must also be open field 7
• F must be closed to prevent the irrigation of field 5
• G, if closed, would only prevent field 3 from being watered and thus must be open as well
• H must also be closed even if F is also closed, as water can flow from the open D and E
• I must be open for field 11
• J, finally, must be closed to prevent fields 9 and 10 from getting irrigated

BACKGROUND INFORMATION
In this task, water flows to the fields based on a number of conditions. For instance, water flows to field
7 if both D and E are open. Water flows to field 3 if G is open and either of these conditions hold: (1) C
is open; or (2) both A and B are open.
These types of compound conditions are formed with the boolean operators:
- AND if two gates are one after the other on the same channel;
- OR if water can flow to the same destination from two separate channel segments.
Boolean conditions are always either true or false.
In programming, booleans commonly occur in if statements which are found in virtually all
programming languages. If statements are used to check that a certain condition is true before
executing a series of instructions.

33
Bebras Challenge
2022 Round 1

Years 5+6
This question comes from Years 3+4 Hard
Switzerland Years 5+6 Easy
Years 7+8

Strange Sorting
Years 9+10
Years 11+12

Beaver Tsuki has a pile of photos taken in 2020, each with the exact date on it. She asks her friend Luna
put the pictures into 12 albums, one for each month. She also asks Luna to sort the albums when she is
done. Tsuki is of course expecting the usual order:

But it is April Fools’ Day, so Luna plays a prank on Tsuki and sorts the albums alphabetically by the
name of the month instead and removes the labels from all but the first three.

Question
Which album contains Tsuki’s pictures from January? Drag the label to the correct album.

EXPLANATION
The pictures from January will be in album #5.
When we sort the months of the year alphabetically, we get the following order:
1. April 7. June Therefore, we will be able to find
2. August 8. March the photos from January in the
3. December 9. May fifth album.
4. February 10.November
5. January 11. October
6. July 12. September

BACKGROUND INFORMATION
We often want to sort things to help keep them organised and make them easier to find. Computer
Science helps us to do this quickly. But before starting the sorting process, it is important to consider if
different orders are possible and to decide which order we want.
In the example, Luna knew what order Tsuki expected, and was playing a prank on her. But a computer
would not have known what order Tsuki expected. When we use a computer to sort something, we
must make sure to tell the computer how to perform the sort.
35
This question comes from Years 3+4
China Years 5+6 Easy
Years 7+8
Years 9+10
The Lost Gold Bar Years 11+12

One day, a bank vault was stolen, and many gold bars were lost. Beaver policemen immediately carried
out a survey. They discovered that the thieves hid the treasure in three of the eight neighbouring
houses. They marked the houses one by one with a 1 or 0 in order to find the lost gold bars.

If the number is marked as 1 it means there is a gold bar in the house, if the number is marked as 0 it
means that there is no gold bar in the house.
The houses are arranged in the following way:

Question
How can the information around the above houses be edited into 1’s and 0’s?

10001001 10011000 01100001 10010000

EXPLANATION
Answer
The correct answer is B - 10011000.

Explanation:
According to the task’s description, the digit 1 represents the presence of gold bars in a house whereas
0 represents the absence of gold bars in a house. When you mark the houses in the sequence as they
are in the picture according to the presence (1) or absence (0) of gold bars, you get a sequence of digits
consisting of 1 and 0. Only the first, fourth and fifth house have gold barss inside, so the first, fourth
and fifth digits in the sequence are 1, and the other digits are 0. The answer is 10011000.

BACKGROUND INFORMATION
This task introduces the idea of the binary system to students. The data in human life can be
represented in many ways and by many different counting systems; decimal, octal, etc. The computer
uses the binary system to store data. Each digit is binary, represented by a digit 1 or 0. When the data
from human life is transferred into the computer, it needs to be converted into the binary system.

36
This question comes from Years 3+4
China Years 5+6 Easy
Years 7+8
Years 9+10
Picking Up Carrots Years 11+12

The little rabbit’s house is at A.


Starting at her house, she is going to pick up carrots. The carrots are shown in the picture below.

Question
The little rabbit wants to pick up all the carrots at the fastest speed and return to her house. Can you
help her find an optimal route?

ABCDEBDA ADEBADCBA ABDABCDEBA ADEBCDABA

EXPLANATION
Answer
The correct answer is A - ABCDEBDA.

Explanation
A There is a carrot on each road. The rabbit should pass each road exactly once if she wants to pick up
all the carrots as quickly as possible.
B This route is longer than the A route, it contains one path more.
C The DE path was travelled twice and the rabbit could not pick up all the carrots.
D The DB path was not traveled so one carrot left.

BACKGROUND INFORMATION
In a connected undirected graph, a path from a point that passes through each route of the graph
exactly once and then returns to the starting point is called an Euler circuit. When the number of nodes
in an undirected connected graph is even, then there is an Euler circuit in the undirected graph.
How to find a Euler circuit?
Starting from any node (houses in this task), we have to find a circuit that leads back to this point.
This method does not guarantee that each side (paths in this task) is travelled. If there is a node and
an edge that is not travelled, then this point should be the starting point and this edge should be the
starting edge, which is connected to the current circuit. This is done until all edges have been travelled.
In this way, the whole graph is joined together.
37
This question comes from Years 3+4
Czechia Years 5+6 Easy
Years 7+8

Counting Out
Years 9+10
Years 11+12

Six Beavers play counting-out. They use a 16-part rhyme.


Eeny - meeny - minie - moe.
Catch a - tiger - by the - toe.
If he - hollers - let him - go.
Eeny - meeny - miny - moe.

They start at the beaver with a hat and count along the arrow. So they finish singing the 16 parts at the
4th beaver (with the jewellery) and she steps out.
Now there are only five beavers left and they start over, exactly the same way as before except this time
starting the count from the next beaver after the one that got out.

Question
Which beaver will step out of the circle next?

EXPLANATION
Answer
The correct answer is “the beaver in the bathing suit”.

Explanation
The simplest way to check it is to actually count out the 16-part chant. This shows the correct answer,
as well as those that are wrong.
However, this is not the fastest way. As you count, you may notice that you regularly come back to the
same beaver. When you count the same beaver as before, the number of remaining parts of the chant

Continued on next page


38
This question comes from Years 3+4
Czechia Years 5+6 Easy
Years 7+8

Counting Out – continued


Years 9+10
Years 11+12

is lower exactly by the total number of beavers in the circle. In other words, you could just subtract the
number of beavers (5) from the number of parts (16) and save some counting! Now you only need to
count to 11.
But why stop there? You can skip another round and subtract the number of beavers again, 11 – 5 = 6.
Do this again for another round, 6 – 5 = 1. Now you can be sure that the counting stops at the beaver
you first started the chant on – the beaver in the bathing suit. In summary, you just subtract the
number of beavers from the chant length as long as you can.
If you want, you can be even faster: this repeated subtraction is just like calculating the remainder after
division. That is, 16 divided by 5 leaves 1 as the remainder, which tells us immediately that the counting
stops at the beaver you first started the chant on – the beaver in the bathing suit.

BACKGROUND INFORMATION
Computer Scientists like solving tasks of this kind: seeing a process that is slow and finding ways to
make it work faster (to optimise it). If you can find a solution quickly in this case, you can even choose a
place in the circle at the start of the game so that you won’t be eliminated.
Shortcuts with remainders are extremely useful. Their applications are found in cryptography
(ciphering), where this technique helps prevent other people from looking at your online activity or
data. This technique is also used in data checking, where the computer looks for potential corruption in
received data.
This question is an example of modular arithmetic, using the modulo operation (mod), which returns
the remainder when one number is divided by another. In this example, this is arithmetic modulo 5,
and the operation 16 mod 5 = 1.
Another example of modular arithmetic is 24-hour time, using arithmetic modulo 12. We know that
1900 hours is 7pm because 19 mod 12 = 7, i.e. the remainder 7 tells us the hour, and since 19 is greater
than 12 we know the time must be pm rather than am.

39
This question comes from Years 3+4
Germany Years 5+6 Easy
Years 7+8

Looking in a Mirror
Years 9+10
Years 11+12

In online meetings you see your own image mirrored on your screen. Normally you do not notice this,
because you are used to seeing yourself in the mirror.
Bo, Jo, Lu, and Vi meet in a video chat. You can recognise them by the names on their shirts.

Question
Whose screen are you looking at?

Bo Jo Lu Vi

EXPLANATION

Answer
Answer D - Vi is correct. You are looking at Vi’s screen. Vi is the only name that is mirrored.

Explanation
An image of an object is inverted with the same size as the original body, except that it differs from
it by being inverted. That is, the right is to the left and the left in the reverse image is the right of the
body in front of the screen.

BACKGROUND INFORMATION
Computer Scientists deal with how information has to be represented in order to be processed
by machines. But they also deal with human-machine interaction. Good software should function
effectively and efficiently. And it should have a user interface with a clear information architecture and
a well thought-out interaction design. The human user should find his way around easily. In online
meetings, it just feels more natural to see yourself as if in a mirror.

40
This question comes from Years 3+4
Turkey Years 5+6 Medium
Years 7+8

Science Fair
Years 9+10
Years 11+12

Bebras High School is having a science fair.


All the events should follow a specific order, and only one event can be held at a time.
The diagram shows all the events that must be included in the flow of a science fair. The arrows
between events indicate that the event the arrow is drawn from has to occur before the event the arrow
points to.

For example, the “Social Interaction” can only happen after both the “Opening Speeches” and the
“Project Presentations” have finished.

Question
What is the correct order of events for the science fair? Drag the event into the correct order.

Awarding Prizes

Preparation of Stands

Social Interaction

Chorus Performance

Referee Reviews

Opening Speeches

Project Presentations

Continued on next page


41
This question comes from Years 3+4
Turkey Years 5+6 Medium
Years 7+8

Science Fair – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
There are actually two possible correct answers in this task:

Option 1 Option 2

1. Chorus Performance 1. Preparation of Stands


2. Preparation of Stands 2. Chorus Performance
3. Opening Speeches 3. Opening Speeches
4. Project Presentations 4. Project Presentations
5. Social Interaction 5. Social Interaction
6. Referee Reviews 6. Referee Reviews
7. Awarding Prizes 7. Awarding Prizes

Explanation
One way to realise flowpattern is to start with an event that has not yet happened, and all the events
pointing at it have already occurred. For example, at the beginning, “Chorus Performance” and
“Preparation of Stands“ are the only events that have no other event pointing at them, so both of
them can proceed in any order. Then, since “Opening Speeches” only had “Choir Performance” and
“Preparation of Stands“ pointing at them, and since both events have already happened, “Opening
Speeches” can now take place.

Thus, all the boxes and pointing arrows should be examined in this manner until we have a valid
sequence of steps according to our diagram. Of course, there can be more than one right answer
depending on the options.

BACKGROUND INFORMATION
Solving this task means performing a topological sort of the graph. In Computer Science, a topological
sort or topological ordering of a directed 91 is a linear ordering. For instance, the vertices of the
graph may represent tasks to be performed, and the edges may represent constraints that one must
be performed before another. Algorithms are known for constructing a topological ordering of any
directed acyclic graph in linear time.

42
This question comes from Years 3+4
Austria Years 5+6 Medium
Years 7+8

Forest Watch
Years 9+10
Years 11+12

The forest rangers need to keep an eye on the animals that wander onto the paths.
They watch the paths from tall towers.
A ranger can only see the paths that connect directly to their tower.

Question
Click on the towers that must have a forest ranger in them so that all the paths are watched, but that
requires as few rangers as possible.

EXPLANATION

Answer
The three occupied observation towers and their overseen paths are shown in the image below.

Explanation
There are eight paths. If there were just two observation towers occupied, one would have to observe
at least four paths. This is not possible, because no observation tower is next to four paths.
Continued on next page

43
This question comes from Years 3+4
Austria Years 5+6 Medium
Years 7+8

Forest Watch – continued


Years 9+10
Years 11+12

BACKGROUND INFORMATION
In Computer Science many things can be represented with graphs. Graphs consist of nodes (= circles)
and edges (= lines), which connect the nodes. For our example, the graph looks like this:

You can ask: “Which nodes (observation towers) do you have to choose at least such that every edge
(forest path) is next to a chosen node (observation tower)?” This question is also known as minimal
vertex cover. It can, for example, be applied when putting up street lights, which should illuminate all
streets. Another example is placing cameras, which should cover all hallways.

44
This question comes from Years 3+4
Australia Years 5+6 Medium
Years 7+8

Mission Possible
Years 9+10
Years 11+12

Alice has been given a mission. She needs to deliver a top-secret package to a house, but first she must
decipher the code to find the correct house number.

Question
Using the example above, what is the correct house number? Type your answer in the text box.

EXPLANATION
Answer
25.

Explanation
In the example, you can see we get to house number 9 by adding all dots together: 8 + 1 = 9.
Therefore, in the question we get to 25 by:
16 + 8 + 1 = 25.

BACKGROUND INFORMATION
Data can take many forms, for example, pictures, text or numbers. When we look at data in this
question, we are looking for a sequence of images that will assist in solving the problem. By identifying
these images we can make predictions, create rules and solve more general problems.
The binary number system plays an important role in how information is stored on computers. This
questions helps students understand how binary can be used to represent information, such as digital
images and numbers.

45
This question comes from Years 3+4
Germany Years 5+6 Medium
Years 7+8

Choices
Years 9+10
Years 11+12

The beaver family have five gifts for their young beavers, one gift for each.
Each young beaver tells the family, which gift would be its first choice and which would be its second
choice.
The family wants to:
1) Give as many first choices as possible,
2) and then as many second choices as possible.
In the diagram below the gifts are shown on the left and the beavers with their choices on the right.

Question
Assign the gifts to the beaver’s present box.

Continued on next page


46
This question comes from Years 3+4
Germany Years 5+6 Medium
Years 7+8

Choices – continued
Years 9+10
Years 11+12

Answer

Explanation
We cannot satisfy all first-place preferences, because two young beavers have the same first-place
preference. The assignment shown above satisfies four first-place preferences, and one second-place
preference. For this case, a better assignment is impossible. Note that if, going from left to right, top to
bottom, you would assign the second gift to the second beaver (just like the first gift to the first beaver,
thus satisfying the second beaver’s first preference), you could not assign a preferred gift to the fourth
beaver any more. This is why there is no other best assignment than the one shown above. That is, in
this problem, it is not sufficient to be “greedy” and take the next best thing one by one.

BACKGROUND INFORMATION
The young beavers ranked the gifts according to their preferences. For each beaver you can consider all
the gifts not mentioned to share the third place in its ranking. The beaver family wants to match gifts
with young beavers in such a way that as many first choices are achieved as possible, then the most
second choices possible.
A matching set is considered optimal if there is no other set with more first-place preferences satisfied
or (if the same number of first-place preferences are satisfied) no more second-place preferences are
satisfied – and so on. In Computer Science this is called rank-maximal matching. There are a wide
variety of matching problems that have been studied by computer scientists.

47
This question comes from Years 3+4
China Years 5+6 Medium
Years 7+8

Maze
Years 9+10
Years 11+12

The little witch Luna accidentally discovers a hidden treasure cave.


To get to the treasure, she needs to pass through a maze. Luna discovers that five exits correspond to
five treasures: coins, rubies, a magic book, a treasure box, and a magic potion.
Luna did not know which treasure to choose, so she decided to follow the following rules to get
through the maze:
• Go south (↓) as a priority;
• When there is no way to the south, go east (→);
• When there is no way to the south or east, go west (←);
• Never turn back and do not go north (↑).

Question
What treasure will Luna find at the end?

EXPLANATION

Answer
The treasure she would find is the chest.

Explanation
When little witch Luna enters the cave she has to fly down according to the first rule. At the first fork,
she can choose to go left or right. According to the second rule, she needs to right. At the second fork
she has to fly down again because this is her priority. For forks three to six the first two rules apply. At
fork seven there is not way down or to the right. Therefore she has to go to the left. By applying all
four rules she finally comes to the treasure chest.

BACKGROUND INFORMATION
In Computer Science conditional statements are used to executes different codes/actions according
to certain conditions or rules. IF the conditions apply, then a code/an action is executed, ELSE other
codes/actions are executed. In this task we have three rules. IF you reach a junction and there is a fork
down go down. Otherwise, IF there is a fork to the right, go right. ELSE got to the left. Little witch Luna
never has to fly up.
48
This question comes from Years 3+4
Canada Years 5+6 Hard
Years 7+8

Crested Birds
Years 9+10
Years 11+12

Crested birds don’t build nests. Instead, they move into empty nests.
When a crested bird finds a tree with empty nests, it moves into a nest as follows. It starts at the
bottom of the tree and repeats the following steps until it finds an empty nest:
1. It goes up until it finds a nest.
2. If the nest is empty, it moves into the nest. Done.
3. If the nest is occupied, the bird looks at the other crested bird in the nest:
- If the other bird has more circular crests on its head than it does, the bird continues up and
to the left.
- If the other bird has the same number or fewer circular crests, the bird continues up and to
the right.
There is a tree with five empty nests, and there are five crested birds.
The birds move into the empty nests in the order they are standing, from left to right; the bird with
four circular crests is the first.

Question
Drag each bird into the correct nest following the steps above.

EXPLANATION

Answer

Continued on next page


49
This question comes from Years 3+4
Canada Years 5+6 Hard
Years 7+8

Crested Birds – continued


Years 9+10
Years 11+12

Explanation
This is the way to find the solution:

The first bird, with four circular crests, moves


into the lowest nest.

The second bird has two circular crests. The


lowest nest is occupied by the first bird, with
four circular crests. Since four is more than two,
the second bird continues to the left and moves
into the next empty nest.

The third bird has three circular crests. Since


four is more than three, at the lowest nest
the bird continues to the left. The next nest is
occupied by the second bird, with twocircular
crests. Since two is less than three, the bird
continues to the right, and moves into the next
empty nest – which is the highest nest.

The fourth bird has four circular crest. Like


the birds before, at the lowest nest, the bird
continues to the left. At the next nest it must
continue to the left, and moves into the next
empty nest, at the very left.

The last bird has five circular crests. It has to go


right at the lowest nest and finds the next nest
(at the very right) empty, where it moves in.

BACKGROUND INFORMATION
Assigning birds to nests in this way has an interesting advantage. It makes finding particular birds quite
efficient. If the bird you are looking for has fewer feathers than the current bird being observed, look in
the left portion of the tree. Otherwise, check the portion of the tree to the right. By repeatedly splitting
the tree in half, the bird you are looking for can be quickly found.
This structured way of organising data is called a binary search tree. It is often used in computer
applications when it is necessary to be able to quickly retrieve data.

50
This question comes from Years 3+4
Switzerland Years 5+6 Hard
Years 7+8

Strawberry Thief
Years 9+10
Years 11+12

Anja makes a design using four types of objects: acorns, mushrooms, pebbles, and strawberries.
She then adds sticks to her design according to her ‘Very Important Rule’.

Very Important Rule:


A stick can only go between two objects if the two objects are different types.
Here is Anja’s completed design:

Anja’s sister Zoë sees the design and eats the strawberry!
To hide what she has done she replaces the strawberry with a different type of object.
She also removes exactly one stick so that the ‘Very Important Rule’ will not be broken.

Question
Click on the stick Zoë removes and click on the question mark until you see the object she replaces the
strawberry with.

Continued on next page


51
This question comes from Years 3+4
Switzerland Years 5+6 Hard
Years 7+8

Strawberry Thief – continued


Years 9+10
Years 11+12

Answer

Explanation
Zoë replaced the strawberry with a mushroom and removed the stick labelled 3 since it violates the
‘Very Important Rule’ by connecting two objects of the same type.

All other strawberry replacements would require Zoë to remove more than one stick.
If Zoë replaced the strawberry with an acorn she would have had to remove sticks 2 and 4.
If Zoë replaced the strawberry with a stone she would have had to remove sticks 1 and 5.

BACKGROUND INFORMATION
Anja’s design can be called a graph. The objects can be called nodes and the sticks can be called edges.
In a graphs, edges connect nodes. Two nodes that share an edge are called neighbours.
A subset of nodes where each node is a neighbour of every other node in the subset is called a clique.
Anja’s design contains two cliques of size four: the left half and the right half of the design.
Now suppose you wanted to assign the nodes of a graph a colour so that no edges connect two nodes
of the same colour. It turns out that the number of colours needed to do this is at least the size of the
largest clique.
Removing the strawberry is like trying to colour Anja’s graph using at most three colours. This is not
possible with cliques of size four, which is one reason why Zoë needed to remove a stick as well.
The problem of how to colour a graph using the minimal number of colours has many applications.
Some examples include scheduling sports competitions, designing a seating plan, and even solving a
Sudoku puzzle.
52
This question comes from Years 3+4
Iceland Years 5+6 Hard
Years 7+8

The Present
Years 9+10
Years 11+12

Bella’s mum bought a present and locked it in a safe.


She gave Bella a blue disc and said: “You can have the present if you can solve the puzzle and get the
key that is in the middlemost drawer.”
To open a drawer, Bella must put an object of the correct shape in the key hole on the drawer. Then the
drawer opens and she can get the object inside which is shown on the front of the drawer.

Question
Help Bella get to the key.
Click on the drawers that Bella must open to get the key.

EXPLANATION
Answer

Continued on next page


53
This question comes from Years 3+4
Iceland Years 5+6 Hard
Years 7+8

The Present – continued


Years 9+10
Years 11+12

Explanation
The task is to find a path from the blue disc to the moon, as the keyhole on the drawer that contains
the key is in the shape of a moon.

To find the solution it helps to draw the objects and arrows (directed graph) to represent what object is
needed to get the object from a drawer.

You can use backtracking from the moon to the circle to help you to find the correct path.

BACKGROUND INFORMATION
A graph is a diagram or pictorial representation of connections between two or more things.
The objects and drawers describe a directed graph: Each object is a vertex connected by edges to
represent relationships between objects and what object gives another object from the drawers.
Representing information using a graph helps to see the structure of a task.
In graphs it is also possible to use backtracking to find the solution. It is also important to be able to
recognise patterns and shapes.

54
This question comes from Years 3+4
Uzbekistan Years 5+6 Hard
Years 7+8

Tree Pruning
Years 9+10
Years 11+12

Beaver Bruno has a tree in his garden. Unfortunately, the tree has a disease and all its leaves died and
turned brown. Now Bruno needs to cut off all the branches with the dead leaves. Then the tree can
grow new branches with healthy leaves.

In the picture, the numbers show the time needed to cut each branch.

When Bruno cuts a larger branch (for example, the branch marked with 5 inside the blue ellipse), all the
leaves attached to it fall down and then Bruno does not need to separately cut all the smaller branches
(the ones marked with 1 and 3 inside the ellipse).

Question
What is the shortest time Bruno needs to cut off all branches with dead leaves?

19 20 22 25

EXPLANATION

Answer
20

Continued on next page


55
This question comes from Years 3+4
Uzbekistan Years 5+6 Hard
Years 7+8

True Pruning – continued


Years 9+10
Years 11+12

Explanation

We can view the tree (the plant) as a data structure that is also called tree. A tree data structure is a
type of another data structure called a graph. With this interpretation, the task is to find the minimal
weight of edges separating all the leaves from the root. This is a standard problem in graph theory
known as the minimal cut (or min-cut for short) and can be solved by various standard algorithms
(Ford-Fulkesron algorithm, for example).

However, there is a much simpler special algorithm for finding min-cut between the leaves and the root
of a tree. We can start moving from leaves towards the root and recalculate for each edge whether it’s
optimal to cut this edge or not.

Let’s illustrate the process:


Initially we start from leaves. For each leaf we cut the branch it is on, thus the initial estimate is:
1 + 3 + 1 + 3 + 3 + 5 + 2 + 1 + 3 + 2 + 1.
Now we move towards the root. In each move we can either leave the “old” cuts, or replace them by
cutting a single larger branch.

The second iteration:


1 + 3 + min(5, 1 + 3) + min(4, 3 + 5) + min(5, 2 + 1) + min(5, 3 + 2 + 1) =
1 + 3 + 4 + 4 + 3 + 5.

The third iteration:


min(9, 1 + 3 + 4) + min(8, 4 + 3) + 5 = 8 + 7 + 5.
Now we reached the root of the tree, hence the final answer is 8 + 7 + 5 = 20.

BACKGROUND INFORMATION
Trees are important data structures in Computer Science. Moreover, there are some contemporary
algorithms that use trees, like decision trees in random forest.
Finding the minimal cut of a directed graph allows us to also find the maximum flow in this graph,
which is widely used in logistics. It helps to determine the maximum weight of goods that can be
transported from the factories to other countries, taking into account all means of transportation
between major cities and their capabilities.
56
This question comes from Years 3+4
Ireland Years 5+6 Hard
Years 7+8

Elephants in the Fridge


Years 9+10
Years 11+12

Each day Joanna’s dad gives her a double sided card to tell her what happened in the fridge over night.
One side tells Joanna whether there was an elephant in the fridge.
The other side tells Joanna if there were footsteps in the butter.
The cards from the last four days are laid out on the table as shown below:

Day 1 Day 2 Day 3 Day 4


There are An elephant has No elephant has There’s no
footprints in the visited the fridge. visited the fridge. footprints in the
butter. butter.

Question
Select all the cards that Joanna can turn over to give her a chance of proving her dad wrong.

EXPLANATION
Answer
The correct cards to turn over are:

and

Continued on next page


57
This question comes from Years 3+4
Ireland Years 5+6 Hard
Years 7+8

Elephants in the Fridge – cont’d


Years 9+10
Years 11+12

Explanation

If Joanna flips , and the other side says there are no footprints in the butter, then she has
successfully proven her dad wrong. Of course, the other side might say there are footprints in the
butter, but at least turning this card gives Joanna a chance to disprove her dad’s claim.

Similar reasoning can be made for the card with showing. If Joanne flips this one over and it
shows an elephant was in the fridge then this again proves her dad wrong, so it is also worth turning
this card over.

If Joanna flips , it doesn’t matter what the other side says. If the other side says an elephant
has visited, it reaffirms her dad’s claim. If the other side says no elephant has visited, then it doesn’t
contradict her dad’s claim since he said nothing about what would happen if no elephant has visited
the refrigerator.

Similar reasoning can be made for the card with showing. Her dad did not say what would
happen if an elephant did not go in the fridge, so turning this card over is not going to prove him
wrong.

BACKGROUND INFORMATION
Logic plays a critical part in the theory and application of Computer Science, from simple Boolean logic
to the forms of logic used in modern Artificial Intelligence systems.
The statement of this task, made by Joanna’s dad is called an Implication (“If A then B”, often written as
“A B”).
Implications, represented with the symbol ⇒, are often used in Expert Systems such as Prolog. These
systems were some of the first generation of successful Artificial Intelligence systems.
Computers can represent such statements internally and combine them with other statements that are
supplied – essentially performing mathematics on information – to calculate new or surprising results.
Implication can be represented as a binary operation and, as such, can be represented in a truth table
much like AND, NOT, and OR:

A B A ⇒B This truth table is somewhat surprising to many people because


it uses “if A then B” in the (different) meaning of “if and only if
False False True A, then B” which means “exactly when A is true then and only
False True True then, B is also true”. Computer Scientists sometimes write “iff”
instead of “if and only if” if they want to use this meaning. But
True False False
the original statement “if A then B” is always true except when
True True True A is true and B is false.

58
59
We would like to thank the International Bebras Committee and community for their ongoing assistance, resources
and collaborative efforts. Special thanks to Eljakim Schrijvers, Alieke Stijf and Dave Oostendorp for their support and
technical expertise.

If you would like to contribute a question to the International Bebras community, please contact us via the details below.

Contact us
CSIRO Digital Careers
[email protected]
csiro.au/Digital-Careers

Australia’s National Science Agency


Bebras Australia
Computational
Thinking Challenge
2022 Solutions Guide
Round 1

Secondary School
Grades 7–12 bebras.edu.au
Bebras Australia
Computational Thinking
Challenge
Bebras is an international initiative aiming The Bebras international community has now
to promote Computational Thinking skills grown to 60 countries with over 2.9 million
among students. ​ students participating worldwide!

Started in 2004 by Professor Valentina ​ ebras Australia began in 2014 and is now
B
Dagiene from the University of Vilnius, administered through CSIRO Digital Careers.
‘Bebras’ is Lithuanian for beaver. This refers
to their collaborative nature and strong In Australia, the Bebras Challenge takes place
work ethic. in March and August–September each year.
As of 2020, two separate challenges are
The International Bebras Committee meets offered for each round.
annually to assess potential questions and
share resources.​Questions are submitted To find out more and register for the
by member countries and undergo a next challenge, visit bebras.edu.au
vetting process.

Engaging young
481
minds for Australian schools

Australia’s
participated in
Round 1 2022

digital future 27,435


Australian students
participated in
Round 1 2022

CSIRO Digital Careers supports teachers and encourages students’ 2.9 million
understanding of digital technologies and the foundational skills Students participate
they require in an ever-changing workforce. Growing demand worldwide
for digital skills isn’t just limited to the ICT sector. All jobs of the
future will require them, from marketing and multimedia through
to agriculture, finance and health. Digital Careers prepares
students with the knowledge and skills they need to thrive in the
workforce of tomorrow.

digitalcareers.csiro.au
2
What is a
Solutions Guide?
Computational Thinking skills underpin the careers of the future. Creating opportunities
for students to engage in activities that utilise their critical and creative thinking along with
problem solving skills is essential to further learning. The Bebras Challenge is an engaging way
for students to learn and practice these skills.

Within this Solutions Guide you will find all of the questions and tasks from Round 1 of the
Bebras Australia Computational Thinking Challenge 2022. On each page above the question
you will find the age group, level of difficulty, country of origin and key Computational
Thinking skills.

After each question you will find the answer, an explanation, the Computational Thinking
skills most commonly used, and the Australian Digital Technologies curriculum key
concepts featured.

3
Contents
What is a Solutions Guide? 3
What is Computational Thinking? 6
Computational Thinking skills alignment 7
Computational Thinking skills alignment 8
Australian Digital Technologies curriculum key concepts 9
Digital Technologies key concepts alignment 10
Digital Technologies key concepts alignment 11
Years 7+8 12
Downtown 13
Best Route 14
Wrestling Holds 16
Butterflies 18
Line of Fish 19
Colourful Tube 21
Hey Taxi! 22
Towns and Highways 25
Ada’s Marble Machine 27
Party Foul 28
Hashing 30
Error Detection 33
Meeting Race 35
Desk Trouble 39
Art Theft 41
Years 9+10 43
Necklaces Instruction 44
Chez Connie 45
Detective Lawn Mower 48
Viewer Numbers 50
Encrypted Path 52
Fruit Stack 54
Bird Migration 57
Ada’s Marble Machine 59
Audit Committee 61
Stacks of Tokens 62
Truchet Tiles 64
Spider Quilts 66
Jumping Jack 69
Still Life 71
Playing with Hats 73

4
Years 11+12 76
Vaccination Centres 77
Secret of the Diary 79
Robo-Rally 80
Snow White 83
Comfort Temperature 85
Secret Number 87
Symbol Reading Robot 89
Cupcakes 93
Bench Workshop 95
Burrow Business 97
Quiz Night 100
Counting by Nodding 102
Log Sort 104
Unification 106
Two Beavers are Working 108

5
What is
Computational
Thinking?
Computational Thinking is a set of skills that underpin learning within the Digital Technologies
classroom. These skills allow students to engage with processes, techniques and digital
systems to create improved solutions to address specific problems, opportunities or needs.
Computational Thinking uses a number of skills, including:

DECOMPOSITION
Breaking down problems into smaller, easier parts.

PATTERN RECOGNITION
Using patterns in information to solve problems.

ABSTRACTION
Finding information that is useful and taking away any information
that is unhelpful.

MODELLING AND SIMULATION


Trying out different solutions or tracing the path of information to
solve problems.

ALGORITHMS
Creating a set of instructions for solving a problem or completing
a task

EVALUATION
Assessing a solution to a problem and using that information again
on new problems.

More Computational
Thinking resources
Visit digitalcareers.csiro.au/CTIA to download the Computational
Thinking in Action worksheets. These can be used as discussion
prompts, extension activities or a framework to build a
class project.
Each resource was designed to develop teamwork; critical and creative thinking;
problem solving; and Computational Thinking skills.

6
Computational Thinking
skills alignment
2022 Round 1 Grade Decomposi- Pattern Modelling &
Abstraction Algorithms Evaluation
Questions level tion Recognition Simulation

Years 7+8

Downtown Easy

Wrestling Holds Easy

Butterflies Easy

Line of Fish Easy

Best Route B Easy

Colourful Tube Medium

Hey Taxi Medium

Towns and Highways Medium

Ada's Marble Machine A Medium

Party Foul Medium

Hashing A Hard

Error Detection Hard

Meeting Race Hard

Desk Trouble Hard

Art Theft Hard

Years 9+10

Necklaces Instruction Easy

Chez Connie A Easy

Detective Lawn Mower Easy

Viewer Numbers Easy

Encrypted Path Easy

Fruit Stack Medium

Bird Migration Medium

Ada's Marble Machine B Medium

Audit Committee Medium

Stacks of Tokens B Medium

Truchet Tiles Hard

Spider Quilts Hard

Jumping Jack Hard

Still Life Hard

Playing with Hats A Hard

7
Computational Thinking
skills alignment
2022 Round 1 Grade Decomposi- Pattern Modelling &
Abstraction Algorithms Evaluation
Questions level tion Recognition Simulation

Years 11+12

Vaccination Centres Easy

Secret of the Diary Easy

Robo-rally Easy

Snow White Easy

Comfort Temperature Easy

Secret Number Medium

Symbol Reading Robot Medium

Cupcakes A Medium

Bench Workshop Medium

Burrow Business Medium

Quiz Night Hard

Counting by Nodding Hard

Log Sort A Hard

Unification Hard

Two Beavers are Working Hard

8
Australian
Digital Technologies
curriculum key concepts
Abstraction
Hiding details of an idea, problem or solution that are not relevant, to focus on a manageable
number of aspects.
Data Collection
Numerical, categorical, or structured values collected or calculated to create information, e.g.
the Census.
Data Representation
How data is represented and structured symbolically for storage and communication, by
people and in digital systems.
Data Interpretation
The process of extracting meaning from data. Methods include modelling, statistical analysis,
and visualisation.
Specification
Defining a problem precisely and clearly, identifying the requirements, and breaking it down
into manageable pieces.
Algorithms
The precise sequence of steps and decisions needed to solve a problem. They often involve
iterative (repeated) processes.
Implementation
The automation of an algorithm, typically by writing a computer program (coding) or using
appropriate software.
Digital Systems
A system that processes data in binary, made up of hardware, controlled by software, and
connected to form networks.
Interactions
Human-Human Interactions: How users use digital systems to communicate and collaborate.
Human-Computer Interactions: How users experience and interface with digital systems.
Impact
Analysing and predicting how existing and created systems meet needs, affect people, and
change society and the world.

For more information on the Digital Technologies curriculum, please visit the
Australian Curriculum, Assessment and Reporting Authority (ACARA) website:
australiancurriculum.edu.au/f-10-curriculum/technologies/digital-technologies
9
Digital Technologies
key concepts alignment
Data Data Imple-
2022 Round 1 Grade Abstrac- Data Specifica- Algo- Digital Interac-
Represen- Interpre- menta- Impacts
Questions level tion Collection tion rithms Systems tions
tation tation tion

Years 7+8

Downtown Easy

Wrestling Holds Easy

Butterflies Easy

Line of Fish Easy

Best Route B Easy

Colourful Tube Medium

Hey Taxi Medium

Towns and
Medium
Highways
Ada's Marble
Medium
Machine A

Party Foul Medium

Hashing A Hard

Error Detection Hard

Meeting Race Hard

Desk Trouble Hard

Art Theft Hard

Years 9+10
Necklaces
Easy
Instruction

Chez Connie A Easy

Detective Lawn
Easy
Mower

Viewer Numbers Easy

Encrypted Path Easy

Fruit Stack Medium

Bird Migration Medium

Ada's Marble
Medium
Machine B
Audit
Medium
Committee
Stacks of Tokens
Medium
B

Truchet Tiles Hard

Spider Quilts Hard

Jumping Jack Hard

Still Life Hard

Playing with
Hard
Hats A
10
Digital Technologies
key concepts alignment
Data Data Imple-
2022 Round 1 Grade Abstrac- Data Specifica- Algo- Digital Interac-
Represen- Interpre- menta- Impacts
Questions level tion Collection tion rithms Systems tions
tation tation tion

Years 11+12
Vaccination
Easy
Centres
Secret of the
Easy
Diary

Robo-rally Easy

Snow White Easy

Comfort
Easy
Temperature

Secret Number Medium

Symbol Reading
Medium
Robot

Cupcakes A Medium

Bench Workshop Medium

Burrow Business Medium

Quiz Night Hard

Counting by
Hard
Nodding

Log Sort A Hard

Unification Hard

Two Beavers are


Hard
Working

11
Bebras Challenge
2022 Round 1

Years 7+8
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Easy

Downtown
Years 9+10
Years 11+12

Beaver Ben has to do some shopping downtown.


The numbers on the roads in the image below
show the walking time from one shop to another.
Ben’s route starts and ends at home (the house at
the bottom of the map).

Question
What is the time of the shortest route to visit all
four shops and get back home?

EXPLANATION
Answer
The correct answer is 55.

Explanation
There are two shortest ways for Ben. One shortest way is as follows: home to grocery to cafe to cake
shop to barbershop to home.
We get another way by following all the arrows along the opposite direction: home to barbershop to
cake shop to cafe to grocery to home.
To answer the question quickly, we can simplify the map. Ben can ignore the road between the
barbershop and the grocery, because it is just as fast to go from barbershop to home to grocery, or the
other way around. Ben can also ignore the road between home and the cafe, because it is just as fast to
go from home to grocery to cafe, or the other way around.
After the map is simplified, it is easy to see what the shortest way must be.

BACKGROUND INFORMATION
This task is similar to the Traveling Salesman Problem (TSP). The problem is to find the best route for a
salesman to visit a list of cities on a map and return home. It is a very famous problem in informatics.
This problem arises in many practical applications. For example, when an express delivery robot tries
to find a route to distribute goods to different destinations, its path planning program may solve a TSP.
Another example is when driving a car, the navigation software in your mobile phone uses TSP to find a
way to avoid traffic jams.
TSP is a hard problem. You may find it not very difficult to help Beaver Ben in the task above. But with
even just a few more cities or shops, say around a hundred, computers will take nearly forever to find
the best route using currently-known algorithms. When there is a need to solve TSP for more cities or
shops computer scientists design algorithms to find approximations (routes which are short enough
rather than shortest) because it takes too much time and computational resources to find the overall
shortest solution.

13
This question comes from Years 3+4
Cyprus Years 5+6
Years 7+8 Easy

Best Route
Years 9+10
Years 11+12

Trucks travel between cities on the highways shown below.

Bridges and tunnels limit how high trucks can be. Specifically, the label on each highway is the
maximum height of a truck that can use the highway.

Question
What is the maximum height of a truck that can be sent from Start to Finish?

EXPLANATION
Answer
The correct answer is 90.

Explanation
To get from Start to Finish, a truck must pass from the three leftmost cities to the three rightmost cities.
Only three highways can be used to do this and the limits on these three highways are 50, 90 and 80.
This tells us that a truck with a height greater than 90 cannot be sent from Start to Finish.

Continued on next page

14
This question comes from Years 3+4
Cyprus Years 5+6
Years 7+8 Easy

Best Route – continued


Years 9+10
Years 11+12

Is it possible for a truck with a height of 90 to be sent from Start to Finish. Yes! If a truck travels using
the route shown below, then the height limits it will encounter will be 180, 90, 95 and 90. The smallest
of these is 90. This means it is possible for a truck of height 90 to be sent from Start to Finish.
Another (longer) way to solve this problem is to carefully check all the possibilities either Starting from
Start or working backwards from Finish.

BACKGROUND INFORMATION
This problem was inspired by limits on data sent on a computer network (e.g. wifi or cables in a
building). Routers and routing algorithms typically direct data traffic. We typically say that data packets
hop from segment to segment. One important consideration is the bandwidth of a hop which gives us a
limit on how quickly data packets can be be transferred along the segment over a given period of time.
This is somewhat like the limit that bridges put on trucks in this problem.

15
This question comes from Years 3+4
Australia Years 5+6
Years 7+8 Easy

Wrestling Holds
Years 9+10
Years 11+12

Tohn Beava is training to become a professional


wrestler. He knows that during a match, he can
be in the ring in any of the six different positions
listed below:
• Laying
• Standing
• Running
• Against the ropes
• In the corner
• Top Rope
His wrestling trainer can teach him a set of moves,
and each move has a list of positions that it can
be performed from. John wants to make sure that
he learns a move for every position, but wants to
learn the fewest number of moves possible, to
make sure that he has more time to practice each
one. The moves that his trainer can teach him and
the positions they can be used from are as follows:

• Crossbody – Running, Top Rope


• Suplex – Standing, Top Rope
• Clothesline – Standing, Running, Top Rope, Against the ropes
• Back Elbow – Standing, In the corner, Against the ropes
• Armbar – Standing, Laying
• Running Splash - Running

Question
What is the minimum number of moves John needs to learn to make sure that he can perform a move
from any position?

2 3 4 5

EXPLANATION
Answer
The answer is 3.

Explanation
There are several ways to achieve this with only 3 moves.
One possible way to attempt this question is to find the move that covers the largest number of
remaining positions possible. In this case, Clothesline (M3) will cover 4 positions – Standing, Running,
Top Rope and Against the ropes (P2, P3, P4, P6). This leaves us with 2 positions left to be covered –
Lying (P1) and In the Corner (P5). There are no moves that will cover more than one of the remaining
positions, so we need to select Armbar (M5) and Back Elbow (M4). Thus, 3 moves (M3, M4, and M5)
covers all positions (P1, P2, P3, P4, P5, and P6).

Continued on next page


16
This question comes from Years 3+4
Australia Years 5+6
Years 7+8 Easy

Wrestling Holds – continued


Years 9+10
Years 11+12

We found an answer with 3 moves. Because the minimum number of moves is sought, we must argue
that it is not possible to have an answer with two moves. This is because if we take any pairs of moves,
that pair will not cover all 6 position. For а pair containing in total less than 6 positions (e.g. for pair of
M1 and M2) this is obvious. And for other pairs, this is easy to check.

BACKGROUND INFORMATION
The problem is also known as a Dominating Set cover problem. Imagine six sets, each representing a
different move. Every set contains the positions that move can be performed from. The task is to select
the smallest number of sets (moves) such that the union of these sets (all positions from which the list
of moves can be performed) contains all elements (positions). In other words, the task is to cover all
elements with the smallest number of sets.
In this case, we are limited in our choices of set for two of the given positions, making it easier to
select sets that will cover the specific list of elements.
The method used for finding the answer in the explanation is called a greedy algorithm, where the
algorithm selects the best possible answer at each stage. At the selection of each move, this algorithm
will select the move that will cover the highest number of positions. It should be noted that a greedy
algorithm is not guaranteed to always produce the optimal solution, but in this case, it will do so
successfully.

17
This question comes from Years 3+4
Canada Years 5+6
Years 7+8 Easy

Butterflies
Years 9+10
Years 11+12

A beaver is photographing butterflies, but after


each photo is taken, half of the butterflies fly
away.The first photo has 64 butterflies on it and
the last photo has just one butterfly on it.

Question
How many photographs did the beaver take?

5 7 3 6

EXPLANATION
Photo Number of
Answer Number Butterflies
The answer is Option D, 6 photos. 1 64
2 32
Explanation 3 16
We are told that the first photo has 64 butterflies in it. Since half 2 8
the butterflies fly away after each photo is taken, we can record
5 4
how many butterflies are in each photo.
6 2
We see that the photo with just two butterflies in it is photo
number 6. 7 1

BACKGROUND INFORMATION
The number of photos the beaver takes is just one more than the number of times that half the
butterflies fly away. So after the number of butterflies is cut in half only five times, we are left with two
butterflies. Notice that six is quite a bit smaller than 64. This is not a coincidence.
The process of repeatedly cutting a quantity in half until you end up with only one item, can occur
quite quickly. That is, you can move from a very large number to a very small number in this way in a
relatively small number of steps. This idea is used by computer scientists to design algorithms which
are very efficient. The most famous algorithm based on this idea is probably something called binary
search. In a math class in a later grade, you might learn about logarithms which help measure this kind
of process.

18
This question comes from Years 3+4
Canada Years 5+6
Years 7+8 Easy

Line of Fish
Years 9+10
Years 11+12

Fish swim in a line as shown.

Occasionally, someone says the positions of two fish. If these positions are A and B where A < B, then:
• all fish to the left of position A swim away, and
• all fish to the right of position B swim away.
For example, after someone said positions 2 and 17, there would then be 16 fish remaining in the line
(now in positions 1, 2, ... 16) as follows:

Positions are numbered starting from 1 on the left and positions are renumbered after any fish
swim away.
Starting with the original line of 20 fish:
• someone says positions 4 and 18, then
• someone says positions 6 and 12, and then
• someone says positions 2 and 5.

Question
After this, which of the following is the new line of fish?

Continued on next page


19
This question comes from Years 3+4
Canada Years 5+6
Years 7+8 Easy

Line of Fish – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
The correct answer is:

Explanation
One way to determine which fish remain is to write down the entire remaining line of fish after each
time someone says two positions. However, we can be a bit more clever by only keeping track of the
leftmost remaining fish and the number of remaining fish. This is because when fish swim away, only
fish that were originally in adjacent positions remain.

After positions 4 and 18 are called, fish , and will swim away as well as some
fish to the right of position 18 so will be the left most remaining fish. Also, 18-4+1=15 fish will remain in
the line. (In general, after calling out positions A and B, B-A+1 fish will remain in the line. Can you see
why?)

Then, after positions 6 and 12 are called, fish , , , and


will swim away as well as some fish to the right of position 12
so will be the left most remaining fish. Also, 12-6+1=7 fish will remain in the line.

Finally, after positions 2 and 5 are called, fish will swim away as well as some fish to the right of
position 5 so will be the left most remaining fish. Also, 5-2+1=4 fish will remain in the line.

This means that the four fish beginning with form the new final line of fish.

BACKGROUND INFORMATION
When a computer programmer is working with data, they need to determine how to represent this
data. Related data is normally stored together in a collection. In this case, a second important decision
is to determine how to arrange the collection in memory. Different data types can be used for this and
one of the most common data types is a sequence. In this task, the fish are arranged in a sequence.
Data types are usually associated with common operations performed on the data. The key operation
in this task is the selection of fish between two given positions. This is one of the most important
sequence operations in general. When the sequence is a list of letters or other characters, it is typically
called a string and this common operation is often named substring, or slice, or something similar.

20
This question comes from Years 3+4
Indonesia Years 5+6
Years 7+8 Medium

Colourful Tube
Years 9+10
Years 11+12

Omar wants to fill a tube with various types of liquids. Omar’s science teacher explains that a liquid
with a higher density will be under a liquid that has a lower density. The teacher gives Omar three
examples of tubes which, between them, are filled with all the liquids available in the lab.

Omar uses the information in the three examples above to fill a new tube
with a different combination of the available liquids.

Question
Only one of the tubes shown below is possible. Which tube could Omar have filled?

EXPLANATION

Answer Explanation
By studying tubes 1, 2 and 3, the order of
all liquids according to their density can
be found, which is:

By comparing the available answers with the overall density order we can then easily spot tubes that
cannot exist. There is only one tube that is consistent with the overall density order, which is the
correct answer.

BACKGROUND INFORMATION
The question shows a repeating pattern that requires students to identify similarities in the component
parts of a problem, namely comparing where liquids appear in each tube to create an ordering of all
the available liquids. This skill is often called pattern recognition and involves looking for patterns in
the problem, finding links to any of the problems or solutions that one may have encountered in this
problem or in previous problems, and applying them to a new situation. Using this skill, it is possible to
use what we have learned in the past to help us solve this new problem.
Two key parts of this skill are called ordering and constraints.
Ordering is putting things into their correct place following some rule. In this question, the rule for
ordering liquids is determined by the density of each liquid.
Constraints are a condition of a problem that the solution must satisfy. In this question, the density of
the liquids becomes a constraint for ordering the liquids.
21
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Medium

Hey Taxi!
Years 9+10
Years 11+12

A self-driving taxi drives people to their desired destination.


The smart traffic signs know where the taxi should go and use these symbols to direct the taxi.

Each symbol has one of these meanings: forward, turn left, turn right and turn back.
Right, left, forward, and turn back are always relative to the orientation of the taxi.

Forward Left Right Turn back

The taxi moves one block at a time, and follows the meaning of each symbol.

Continued on next page


22
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Medium

Hey Taxi! – continued


Years 9+10
Years 11+12

Question
The traffic symbols in this picture direct the taxi from the industrial park to the airport .
What is the meaning of each traffic symbol?

EXPLANATION

Answer Explanation
The correct answer is: The path from the starting point to the
destination is shown:

Continued on next page


23
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Medium

Hey Taxi! – continued


Years 9+10
Years 11+12

The other options end up in other destinations.

BACKGROUND INFORMATION
The computational thinking concept illustrated with this task is algorithms. A very simple computer
program is written using four different types of instructions. Given the output of the program, you must
figure out which symbol means which instruction.
Self-driving cars and other self-driving vehicles are examples of artificial intelligence that are slowly
becoming an everyday part of life. The taxi in this task would need to be equipped with a broad range of
sensors (like cameras, radar, ultrasonic) to understand its environment.
Computer vision software would use these sensors to keep the taxi in lane, follow signs, and avoid
pedestrians.
While the taxi in this task is self-driving, it is not fully autonomous, because it follows one sign after
another to get to its destination. An autonomous vehicle would use artificial intelligence to decide
its own route based on sensing of the environment, GPS and map data, traffic reports, and even
information from other autonomous vehicles!

24
This question comes from Years 3+4
Slovakia Years 5+6
Years 7+8 Medium

Towns and Highways


Years 9+10
Years 11+12

Below is a map of five towns and four highways. The black dots with letters are the towns. The
coloured lines are the highways.

C
D
E

This map can be represented as a simplified diagram in which:


• towns are represented by circles
• two towns are connected with a line when they lie on the same highway.

Question
Which diagram represents the map correctly?

EXPLANATION

Answer

Explanation:
By studying the map carefully, we can see that:
• Town A lies on the same highway as the town D.
• Town B lies on the same highway as the towns C and D.
• Town C lies on the same highway as the towns B, D and E.
• Town D lies on the same highway as all the other towns.
• And finally, the town E lies on the same highway as the towns C and D.

Continued on next page


25
This question comes from Years 3+4
Slovakia Years 5+6
Years 7+8 Medium

Towns and Highways – continued


Years 9+10
Years 11+12

These conditions are met by only the fourth diagram option, which is the correct answer. All of the
other options are wrong:
• For the first option, there are connection between towns A and B, as well as between A and E, and
those towns don’t lie on the same highways.
• For the second option, the connection between towns E and C is missing.
• For the third option, not only is the connection between the towns E and C missing, but there is a
connection between towns A and B when these towns don’t lie on the same highway.
It is important to note some subtle but important features of the map that can lead to an incorrect
choice of diagram:
• Even though town A can reach town B, they are actually not on the same highway.
• Even though towns E and C has another town in between them, they are still on the same highway.

BACKGROUND INFORMATION
In computer programs, reality must be represented by some data so that the computer can process
them. The same reality can usually be represented in several different ways and computer programmers
need to choose the one that is the most suitable for the task (algorithm) their program has to perform.
Therefore it is essential for computer programmers to know many kinds of representations.
One commonly used representation is a graph – a diagram made of vertices (usually circles with names
in or besides them) and edges (lines connecting vertices). A big part of informatics (where it overlaps
with discrete mathematics) is called Graph Theory and it defines many useful algorithms for data
represented by graphs.
But, as this task shows, the same reality can be represented by several kinds of graphs – the first picture
is also a graph (when we abandon the parts of highways that do not connect any two towns), but it
connects the towns in a slightly different way than the graph in the solution.

26
This question comes from Years 3+4
Australia Years 5+6
Years 7+8 Medium

Ada’s Marble Machine


Years 9+10
Years 11+12

Ada the engineer has been asked to create a sorting machine to sort marbles based on the following
aspects:
• size (small, medium or large)
• colour (red, blue or yellow)
• material (stone, glass or metal)
• decoration (glitter, plain or mosaic).
Ada knows the following restrictions on the marble designs:
• each marble can only be of one size, one colour, one material, and one decoration
• marbles made of metal cannot be large-sized
• marbles made of stone cannot be red or yellow
• the glitter decoration cannot be applied to marbles made of metal or stone
• the mosaic decoration cannot be applied to marbles made of metal

Question
If a large, blue marble is plainly decorated, what is the marble made of?

Metal or stone Stone or glass Glass Not enough information to tell

EXPLANATION
Answer
B) Stone or glass.

Explanation
As the marble is large, it cannot be made of metal (Restriction 2), so it must be made of stone or glass.
The blue colouring and plain decoration do not tell us more about the material of the marble.

BACKGROUND INFORMATION
This question looks at sorting (i.e. categorising) objects based on given criteria. There are four
criteria that we can use to sort the marbles by (size, colour, material, decoration), either alone or in
combination.
We also need to work with constraints, which are restrictions or limitations on our solutions or
methods. In this case, there are 5 restrictions which are applied to the marble designs. When these
restrictions are combined, only a few design options remain.
A digital example of sorting with constraints is using filters to find subsets within a given data set. This
can occur in spreadsheets, where a filter can be applied to omit/select certain rows. This can also occur
in search results – such as from a search engine or online shopping interface – where a filter can refine
the results to match desired criteria.

27
This question comes from Years 3+4
Australia Years 5+6
Years 7+8 Medium

Party Foul
Years 9+10
Years 11+12

Corey Beaverton is having a party this weekend. He would like to meet


new people. The party invitation includes an instruction to make four
identical copies of the invitation and send them to another four people.
Corey sends out the first round of invitations to four of his friends. Each
new group of invitations goes out in a round. Each beaver only sends out
one set of invitations.
Corey forgets to put a limit on how many people can be invited in total.

Question
Assuming that no beaver is invited more than once, how many rounds of invitations will be sent out
before more than 500 beavers in total have been invited to Corey’s party?

4 5 10 125

EXPLANATION
Answer
The correct answer is 5.

Explanation
In the table below, the number of new beavers invited to the party is shown for each round, along with
the total number of beavers invited.

Invitation Round New Beavers Invited Total Beavers Invited


1 4 4
2 16 20
3 64 84
2 256 340
5 1024 1364
6 4096 5460

In the first round (R1), Corey sends out 4 invitations inviting beaver 1, 2, 3 and 4 (B1 to B4). See the
illustration below. After the first round, 4 beavers (not including Corey) are invited to the party.
1x4=4
[Corey x 4 invitations = newly invited beavers]

During the second round (R2) each of the four beavers sent out four more invitations, inviting 16 new
beavers (B5 to B20), making a total of 20 beavers invited. See calculation below.
4 x 4 = 16
[Invited beavers from R1 x 4 invitations = newly invited beavers]
16 + 4 = 20
[newly invited beavers + Invited beavers from R1 = total beavers invited in R2]
Continued on next page
28
This question comes from Years 3+4
Australia Years 5+6
Years 7+8 Medium

Party Foul – continued


Years 9+10
Years 11+12

In the third round (R3), the 16 beavers invited in the second round invited another 64 beavers, making
the total invited beavers 84. The third round includes beavers 21 to 84.
16 x 4 = 64
[Invited beavers from R2 x 4 invitations = newly invited beavers]
64 + 20 = 84
[newly invited beavers + Invited beavers from R2 = total beavers invited in R3]

In the fourth round (R4), those 64 beavers invite a further 256 beavers, making the total beavers
invited, 340. The 265 beavers sent out invitations to beaver 85 to 340.
64 x 4 = 256
[Invited beavers from R3 x 4 invitations = newly invited beavers]
256 + 84 = 340
[newly invited beavers + Invited beavers from R3 = total beavers invited in R4]

The fifth round (R5) sees the 256 beavers invited in R4 send out invitations to a further 1024 beavers.
This round includes beaver number 341 to 1364. Therefore 500 beavers would have been reached after
sending out the fifth round of invitations.
256 x 4 = 1024
[Invited beavers from R4 x 4 invitations = newly invited beavers]
1024 + 340 = 1364
[newly invited beavers + Invited beavers from R4 = total beavers invited in R5]

BACKGROUND INFORMATION
It is often surprising how a lot of small numbers may combine together to one very large number,
especially when multiplication is involved.
Hearing that something was multiplied fourfold two times in a row, may easily suggest the number 8
to you (for eight is two times four, is it not?) while in fact multiplying a quantity by 4 and then again by
4 is the same as multiplying the original by 16. (Which is 4². We call 4 the base and 2 the exponent.
The exponent tells us how many times a number is multiplied by itself.)
When something grows by multiplying it over and over by the same number (instead of adding the
same number to it again and again) we say that it grows exponentially. Even starting small, exponential
growth can quickly lead to huge numbers, as you have noticed in this task.
In informatics exponential growth is encountered often. Sometimes it is a bad thing: a computer virus,
meant to harm your computer, may work by spreading copies of itself by e-mail to other computers –
a bit like real viruses spread from person to person. Even if a virus on a single computer can copy itself
only to a small number of other computers every day (say 4), then the number of infected computers
after 4 days is already more than 500!
Computer programmers can also use exponential growth to their advantage. If for instance you
have to search for something among a million items and at each step you can throw away half of
the possibilities, then after just 20 steps you will have found what you are looking for. This is a kind
of exponential growth ‘in reverse’: discarding half of the possibilities is the same as multiplying the
number of possibilities by ½, and ½ times ½ times ½ times ½ … quickly becomes a really really
small number.

29
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Hard

Hashing
Years 9+10
Years 11+12

Harish accompanied his friend Sue to the Bebras Public Library. The library only had one huge bookcase
made of many bays arranged in rows and columns. Sue wanted to borrow the book “Constructing
Dams For Beginners”.
When they arrived, Sue went straight to the bookcase and pulled out the correct book.

“How did you know where the book was?” Harish asked surprised. Sue smiled and showed him
two pieces of paper:

“I took the first letter of each word in the title and converted them into a number using the table. Then I
multiplied the number of the first letter by 2 and added the number of the second letter. I then multiplied
the result by 2 and added the number of the third letter. Finally, I multiplied that result by 2 once more
and added the number of the last letter. I looked in the row of the second-to-last digit and in the column
of the last digit for the book. It is very easy to find that way, even if there are three books in the bay,”
explained Sue.
“But what about numbers greater than 99?” asked Harish.
Sue replied: “I just ignore all digits except for the last two.”

Continued on next page

30
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Hard

Hashing – continued
Years 9+10
Years 11+12

Question
In which bay can Harish find the book “How To Avoid Falling Trees”?
Select the correct numbers on the sides of the bookcase to the corresponding bay.

EXPLANATION
Answer
There are two correct answers for this task:
1. The book is in the bay that is in row 2 and column 4.
2. The book is in the bay that is in row 6 and column 6.

Explanation
The first acceptable answer is from the perspective of a developer who has had the method explained
to them from a non-programmer. The speech marks show that this is a conversational description. The
developer concludes that the speaker is giving an example and infers that for books with titles that
have more than four words the calculation is:

Taking the last two digits of 324 gives the


row and column.
The second acceptable answer is from
the perspective of a computer working
through the algorithm provided, without
interpreting it in any way. The calculation
continues as above until 146 is calculated
but the description provided by Sue says
to add the number of the last letter at this
stage, which is 20, giving 166.
Continued on next page

31
This question comes from Years 3+4
Austria Years 5+6
Years 7+8 Hard

Hashing – continued
Years 9+10
Years 11+12

BACKGROUND INFORMATION
Behind the algorithm used by the Bebras Public Library is a concept called “hashing”.
If no system is used to sort the bookshelf, a (linear) search of every book would be necessary to find
the book. On average you would have to check 50% of all books to find the desired book. Imagine
searching the Library of Alexandria (~100,000 books), the Library of Congress (~38,000,000 books) or
even just your local or your school’s library using this method - it could take days to find a single book!
This problem does not only exist for libraries. Big pharmacies also need to have a system to store and
retrieve their medicine. In the last few years more and more pharmacies are adopting automated
storing systems. For pharmacies a systematic order, sorting by type of medicine for example, doesn’t
matter. Instead they look for an even distribution on the shelf.
Here the concept of “hashing” comes into play. A hash value is a value calculated via a hash function
from properties of an item. In the case of this task the title of a book is transformed into two digits
that make up the row and the column of a bay on the shelf. Of course, different books can end up with
the same hash value like the books Tree Bark Gourmet Guide and Tasty Trees to Gnaw On. There are
different ways of dealing with such a conflict.
One way is to simply put several items into the same place like in a bay on the shelf. If it’s not possible
to store multiple items in the same place, then the next empty place is chosen, or an empty place
n places away can be chosen instead to create a more even distribution. If that place is also not
empty, the place a further n places away is checked. This is repeated until an empty place is found. To
eventually fill up all places, n is chosen to be coprime to the total number of places - in the example
below, 7 is chosen as there are 100 bays on the shelf and 100 and 7 do not share any common divisors
except for 1.

32
This question comes from Years 3+4
Hungary Years 5+6
Years 7+8 Hard

Error Detection
Years 9+10
Years 11+12

In a Bebravian city, electricity is produced by wind turbines. The electricity then gets carried to the
houses through the network shown below.
Electricity can be carried from house to house in any direction. However, some links are faulty - the two
houses with the lights off don’t have electricity anymore! All the others houses do.
The map allows each connection to be labelled by clicking on the question marks.
They toggle through these three symbols:

The connection is known to be faulty.

The connection is known to be working.

It is not possible to tell if the connection is working or faulty.

Question
In what state are each of the connections?

Continued on next page


33
This question comes from Years 3+4
Hungary Years 5+6
Years 7+8 Hard

Error Detection – continued


Years 9+10
Years 11+12

EXPLANATION
Answer
Here is the map showing what we know about the links in the electricity-distribution network:

Explanation
The first thing we know is that the two direct links to house E and the three direct links to house C are
all faulty. As all neighbouring houses have electricity, a working link would have brought electricity to
houses C and E as well.
Next, links that are alone in providing electricity to houses where the lights are on cannot be faulty,
otherwise no electricity could arrive there. This is the case for the link leading to house H and the link
from house G to F. The link from the windmills to house A must also be working, otherwise no one
would have electricity at all.
The remaining houses, B, G, and D, are multiply connected to house A. For instance, B can get its
electricity directly from A, but it could also get it from G if the link to A was faulty. The same can be
said about D. Finally, G can get its electricity either from B or from D. One of the links in the A – B – G
– D – A cycle could thus be faulty and these four houses would still get electricity. It isn’t possible to
determine the state of any of these connections from the current information.

BACKGROUND INFORMATION
In computer networks, just like in electricity-distribution networks, some links can be faulty —
slow, overloaded, or outright broken. Having redundancy in the structure of a network ensures its
continuous availability in case of faults (provided there are not too many faults at the same time).
To represent network structures, computer scientists use the notation of graphs. A lot of algorithms
exist to work with graphs in order to, for instance, determine a faulty link as efficiently as possible
given the network structure.
Fixing errors in a system is a task computer scientists very often have to do, not only in computer
networks but also in software development. To fix an error, one has to identify its precise source, and
this process is usually done gradually in several steps. Some programmers believe you never can find all
the errors and bugs in a program.

34
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Meeting Race
Years 9+10
Years 11+12

Two friends need to meet urgently. They are at opposite ends of a park - see the map below.
The friends need to end up on the same square to meet. They both travel according to the following
rules:
• They cannot travel diagonally.
• They cannot travel over water.
• Walking from one square to a neighbouring square takes exactly one minute.
• If they reach a bike or car they can use it to travel faster:
– 2 squares in one minute with a bike
– 5 squares in one minute with a car.

You can use the picture below to help you solve the question. Click on the squares to toggle between
the two friends.

Question
What is the minimum number of minutes they need to end up on the same square?

Continued on next page


35
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Meeting Race – continued


Years 9+10
Years 11+12

EXPLANATION
Answer
4.

Explanation
The meeting can take place in 4 minutes using the route shown below:

(Another option is to take the leftmost bike and cycle to the leftmost car and then continue as above.)
To see why 3 minutes are not sufficient (and therefore 4 minutes is the minimum time needed), one
can reason as follows:
• Although in 3 minutes the friend in the bottom left can reach the car on the left, there is no time to
drive it anywhere. And that position cannot be reached in 3 minutes by the other friend. The car in
the middle cannot be reached within 3 minutes. So the cars can be ignored if trying to find a route
in 3 minutes.
• The two friends are more than 5 minutes away from each other on foot, so they need a bike. In fact,
both need a bike because they are separated by more than 9 positions. But finding that bike costs
one minute and with only two minutes left they cannot reach each other, even by bike.

Continued on next page


36
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Meeting Race – continued


Years 9+10
Years 11+12

BACKGROUND INFORMATION
An common way for many people to solve this task is to simply stumble onto a short path, or to try out
dozens of different possibilities and choose the one with the shortest time. A computer program that
is designed for this kind of task would use a systematic approach, most probably using an algorithm
called breadth-first search. For this task, this would be done as follows:

1. Mark all squares on the map that can be reached by


either friend in one minute.

2. Mark all squares that can be reached in (at most) one


minute from the positions you marked in step 1 and
keep track of which kind of transportation you were
using.

3. Mark all squares that can be reached in one minute


from the squares marked in step 2. Because the two
areas that we have marked do not overlap, you see that
the friends cannot yet reach each other in 3 minutes.

4. Do one more step: mark all squares that can be


reached in one minute from the squares marked in
step 3.

Continued on next page


37
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Meeting Race – continued


Years 9+10
Years 11+12

Now the two regions that we have marked overlap (in one square) indicating that after 4 minutes the
two friends are able to meet.
Many people today use software that finds the fastest route between two places on a map taking care
only to follow roads and not drive through mountains and rivers. This task is very similar but now two
persons move towards each other instead of one person towards a fixed position.
Because of the systematic way in which the search for a solution is done, a computer will often find
solutions that are not obvious at first – sometimes a detour with fewer traffic lights can be a better
option than a direct road, or a public transport route with several quick transfers turns out to be faster
than a direct bus.
In computer science various methods are known for finding the best solution to a problem like
this. Apart from the depth-first search method described above, there is also the branch and bound
technique, which is quite similar but uses well-reasoned shortcuts to speed up the search. For example,
if we have already found a pretty good solution then we may discard options which we know cannot
produce a better solution than the best one found so far.
When a problem becomes too complex, going through all possible solutions to find the best one will
take too long even for a fast computer. And in practice it is often sufficient to find a very good answer
even if it is not the best possible. (If you can reach your destination in 78 minutes you are probably not
bothered by the fact that there is another route that could have taken you there in 77.)
One technique that is used in that case is the greedy algorithm, which at each step chooses what
seems optimal at that time and does not look ahead at what could happen in further steps. For this
task that would mean that the two friends always take a step that brings them closer together, which in
this circumstance is not a good strategy because then they would go on foot most of the way. However,
there are other types of problem in which this greedy strategy produces reasonably good solutions,
and finds that soluition much faster than the other methods.

38
This question comes from Years 3+4
El Salvador Years 5+6
Years 7+8 Hard

Desk Trouble
Years 9+10
Years 11+12

In the computing classroom, students adjust the heights of their desks by using an electrical system
of three buttons. The desks can’t be lowered below 0 units, but can be raised to any height. The
recommended height of the students’ desks is 60 units.

After the control buttons got wet, this is how they function:
• The “A” button raises desktops 1, 2 and 3 by 10 units, each time it is pressed.
• The “B” button lowers desktops 2, 3 and 4 by 10 units, each time it is pressed.
• The “C” button raises desktops 1, 3 and 4 by 10 units, each time it is pressed.

Question:
Which of the following combination of button presses would place all the desks at the recommended
height of 60 units?

Press “A” 3 times, “B” 4 times and “C” 2 times

Press “A” 4 times, “B” 5 times and “C” 1 time

Press “A” 5 times, “B” 1 time and “C” 0 times

Press “A” 2 times, “B” 4 times and “C” 6 times

Continued on next page


39
This question comes from Years 3+4
El Salvador Years 5+6
Years 7+8 Hard

Desk Trouble – continued


Years 9+10
Years 11+12

EXPLANATION
Answer:
Press “A” 3 times, “B” 4 times and “C” 2 times.

Explanation:
By methodically checking each answer below, it can be determined that only the option in bold gives
the correct answer.
1. Press “A” 3 times, “B” 4 times and “C” 2 times.
2. Press “A” 4 times, “B” 5 times and “C” 1 time.
3. Press “A” 5 times, “B” 1 time and “C” 0 times.
4. Press “A” 2 times, “B” 4 times and “C” 6 times.
If someone presses the “A” button 3 times, desks 1, 2 and 3 will have heights of 40, 100 and 80 units,
respectively. If someone presses the “B” button 4 times, desks 2, 3 and 4 will have heights of 60, 40 and
40 units, respectively. Finally, if someone presses the “C” button 2 times, the heights of desks 1, 3 and
4 will all be 60 units. As all the desks are at the recommended height of 60 units, the goal has been
achieved.

Option b is wrong because if someone follows these instructions, the final heights of desks 1, 2, 3 and 4
will be 60, 60, 50 and 40 units respectively. Just two of the desks are at the recommended height.
Option c is wrong because if someone follows these instructions, the final heights of desks 1, 2, 3 and 4
will be 60, 110, 90 and 70 units respectively. Only one desk is at the recommended height.
Option d is wrong because if someone follows these instructions, the final heights of desks 1, 2, 3 and 4
will be 90, 50, 90 and 100 units respectively. None of the desks has the recommended height.

BACKGROUND INFORMATION
In programming, we look for computers to solve specific tasks using the instructions we give them.
Often, we need computers that perform particular actions in some cases, and different actions in other
cases. Conditional sentences allow the computer to choose which processes it needs to act on, based
on different parameters given in the program.
In this task the answer can be considered as the program, written by the programmer, to achieve the
desired goal. A more useful program would be one that is able to find the sequence of events needed
to achieve a variety of goals from a variety of starting points. This type of program would likely have a
greater level of complexity.

40
This question comes from Years 3+4
Slovenia Years 5+6
Years 7+8 Hard

Art Theft
Years 9+10
Years 11+12

TransArt is a company that transports paintings. Paintings are brought to a store for inspection, and
then couriers transport them to their final destination. When a painting arrives at the store, it is put at
the top of the stack of paintings already there. When a courier takes a painting to deliver it, they take
the painting that is at the top of the stack.
For security reasons, TransArt keeps good records of all paintings coming in and out. The records of a
particular day are shown below:

Paintings brought in Times paintings were


the store taken from the store
Time Painting Time Courier
11:40 Beavers on 12:25 A
the Grass
12:15 Happy 13:35 C
Beaver
12:55 Sun and 14:35 A
Moon
13:30 Enchanted 14:40 B
Forest
14:18 Oak and 15:20 C
Birch
15:10 Swampy 15:35 D
Romance

However, that evening TransArt was told that “Sun and Moon” never reached the museum that was
supposed to receive it. The courier who took it from the store must have stolen it!

Question
Who took “Sun and Moon”?

A B C D

EXPLANATION
Answer
B.

Explanation:
There are two important types of events:
1. Somebody puts a painting on the stack.
2. Somebody takes a painting from the top of the stack.
From the tables in the task, we can create a new table that displays the events and the resulting state
of the stack, sorted by time.

Continued on next page


41
This question comes from Years 3+4
Slovenia Years 5+6
Years 7+8 Hard

Art Theft – continued


Years 9+10
Years 11+12

Time Event Paintings on the stack


11:40 Arrival of Beavers on the Grass Beavers on the Grass
12:15 Arrival of Happy Beaver Happy Beaver, Beavers on the Grass
12:25 A takes Happy Beaver Beavers on the Grass
12:55 Arrival of Sun and Moon Sun and Moon, Beavers on the Grass
13:30 Arrival of Enchanted Forest Enchanted Forest, Sun and Moon, Beavers
on the Grass
13:35 C takes Enchanted Forest Sun and Moon, Beavers on the Grass
14:18 Arrival of Oak and Birch Oak and Birch, Sun and Moon, Beavers on
the Grass
14:35 A takes Oak and Birch Sun and Moon, Beavers on the Grass
14:40 B takes Sun and Moon Beavers on the Grass

... and we can stop here as we have reached the critical information in the records that says
courier B has taken “Sun and Moon”.

BACKGROUND INFORMATION
There are three computer science ideas that appear in this task.
One is the concept of a stack. A stack is not only a stack of paintings, but also a data structure,
organised so that the last element that is put on stack is the first one to be popped from it (“Last In –
First Out” or LIFO in short).
The second is merging. To reach the solution, we had to take two sorted lists (events sorted by
timestamps) and merge them into one sorted list – the one shown here in the solution. This step is the
base of one of the fastest algorithms for sorting data, the merge sort.
Finally, the entire process can be considered as the execution of a program. The theft of the painting
is like an event that causes a running computer program to stop or “crash”. This is called an exception.
To find the cause of an exception (which could be thought of as either the misbehaving courier or
the misbehaving lines in the program), we need to follow the program execution until we reach the
point where it crashes. This is called tracing. Then a programmer would try to find a way to handle the
exception in order to prevent a crash of the program.

42
Bebras Challenge
2022 Round 1

Years 9+10
This question comes from Years 3+4
Belgium Years 5+6
Years 7+8

Necklaces Instruction
Years 9+10 Easy
Years 11+12

You like to design necklaces from beads with various shapes, and you would like to easily share your
design with your friends using a compact representation. Each shape is described with a single bead
letter (S for star, T for triangle, R for rectangle and L for line). Instead of just writing down the sequence
of beads in the necklace, you use the following rules:
• if there are several identical beads following each other, just write the number of beads followed by
the bead letter
• if there is a repeating sequence of beads, just write the number of repetitions followed by the
repeated sequence in parentheses
• otherwise, just write the bead letter.
For example, for the following necklace:

one possible description is S3(TR)3SL, which has a length of 9 symbols.

Question:
How many symbols are there in the shortest representation for the following necklace?
(a symbol is either a digit, a letter or a parenthesis)

12 13 14 15

EXPLANATION
Answer
The correct answer is 13 (option B).

Explanation
There are many possible ways to represent this necklace depending on whether you use star-triangle
or triangle-star as the repeated pattern. All of them give a different representation, with the first two
results below being the shortest:
• S2RT3S3(ST)4L with 13 symbols,
• SRRT4STSTST4L with 13 symbols,
• and S2RT4S2(TS)T4L with 14 symbols.
One can see that some representations are more efficient than others. For example, the second option
writes out the repeating triangle-star pattern as TSTS for a total of 4 symbols, while the bottom option
writes it out as 2(TS) for a total of 5 symbols. Therefore, comparing these options and optimising for
the shortest symbol length is a valid approach to solving the question.

BACKGROUND INFORMATION
This task is related to the data compression. The idea of this field is to design techniques to make
it possible to represent and store data using the smallest amount memory, while still being able to
recover the original data at any time. All of these techniques use similar approaches, which is to identify
redundancy in order to represent it in a more compact way. This is exactly what happens in this task
when the repetitions of beads can be represented in a shorter way compared to explicitly writing out the
repeated beads or sequence of beads - TSTSTS may be more efficiently written as 3(TS), for example.
44
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Chez Connie
Years 9+10 Easy
Years 11+12

The takeaway restaurant “Chez Connie” is always busy at lunchtime because it sells three delicious
menu items:

• Ice cream, which can be prepared in 3 minutes;


• Crêpe, which can be prepared in 8 minutes;
• Pizza, which can be prepared in 12 minutes;
There are three queuing windows A, B, and C. All three menu items can be prepared at any window.
Connie wants to organize the orders so that the clients get served as quickly as possible. She notes the
incoming orders on numbered pieces of paper so that she knows which order arrived first.
This is her first order today:

Then Connie distributes the orders to the windows A, B, and C. She always assigns the next order to
the first available window. If two or more windows become available at the same time, the orders are
assigned in the windows’ alphabetical order - in other words, window A first, then B, then C.

Question
Connie has already distributed the first four orders. Can you distribute the next six orders?

Continued on next page


45
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Chez Connie – continued


Years 9+10 Easy
Years 11+12

EXPLANATION
The correct solution is:

To distribute the orders to the different windows,


Connie has to compare the time needed to
prepare the items that are already in each
window’s queue.

When we start allocating orders, the windows already have the following preparation time needed:
• Window A: 11 minutes
• Window B: 12 minutes
• Window C: 3 minutes
The next item (5) will be allocated to Window C, as it has the shortest preparation time at this point.
This makes the new preparation times:
• Window A: 11 minutes
• Window B: 12 minutes
• Window C: 11 minutes
Since we have the same time needed for preparation at both Window A and Window C, we assign
the next two orders in alphabetical order. Since we know that assigning anything to A will make C the
shortest time needed, we can go ahead and assign orders 6 and 7 at once, assigning #6 to Window A,
and #7 to Window C. This makes the new preparation times:
• Window A: 23 minutes
• Window B: 12 minutes
• Window C: 14 minutes
At this point, Window B has the shortest preparation time needed, so we can assign the next order (8)
to that window. This makes the new preparation times:
• Window A: 23 minutes
• Window B: 20 minutes
• Window C: 14 minutes
The next order (9) will be allocated to Window C, since it has the shortest preparation time needed by
far. This makes the new preparation times:
• Window A: 23 minutes
• Window B: 20 minutes
• Window C: 26 minutes
This leaves us with the last order (10) - the window with the shortest preparation time at this point is
Window B, so order 10 will be allocated to Window B.
Continued on next page
46
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Chez Connie – continued


Years 9+10 Easy
Years 11+12

BACKGROUND INFORMATION
In modern computers, there are several processors, or several processor cores, which can carry out
basic operations (like addition or multiplication) mostly independently of each other. In this task, the
analogy with the three windows is direct: the three windows can each work on an order independently
of the others.
Rather than preparing food like the windows in this question, processors execute programs: sequences
of instructions of varying lengths designed to solve a given task. Often, hundreds of these programs
(which are referred to as processes here) are waiting for a processor to become free and to start
executing them. The attribution of processes to processors is called scheduling and is handled by the
computer’s operating system. In order to solve this task, we must play the role of the operating system
ourselves - distributing orders to windows is similar, albeit in a simplified way, to assigning processes to
processors at a given time.

47
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Detective Lawn Mower


Years 9+10 Easy
Years 11+12

Angela arrived at the park this morning to discover a statue is missing!

A robotic lawn mower cuts the grass in the park each night. By looking
at a map of the mower’s movements and comparing it to the mower’s
movement rules, we can determine where the missing statue used to be
located in the park.

The robotic lawn mower moves according to these rules:


• When the mower starts, it selects a random direction and then proceeds straight forward.
• When the mower hits an obstacle or reaches the park boundary, it turns in a new, randomly selected
direction and goes straight.
• When the robot’s battery is low its behaviour changes: once it comes close to the park boundary, it
follows the boundary back to the charging station and stops.

Question
Select the circle that marks the missing statue’s location.

Continued on next page


48
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Detective Lawn Mower – cont’d


Years 9+10 Easy
Years 11+12

EXPLANATION

Answer

Explanation
The missing statue was located in the bottom right-hand corner of the park as shown below. This is
where the robot mower’s behaviour changed over the course of the night, as it collided with an object
during its first pass but did not collide with an object on its second pass.
We can create a detailed description of the map to see that this is the case:
Shortly after the robot started mowing it changed its
direction in the middle of the lawn. This shows that it
had hit an obstacle, the tree. The robot continued in
a new direction until it reached the boundary of the
park where it changed direction and continued until
it hit the park bench. The robot went on to collide
with the flower bed, park boundary, the statue, park
bench (again), flower bed (again), park boundary,
the tree (again), and then eventually reached the
boundary. The robot changed direction and again
moved through the area where there had previously
been an obstacle (the statue) but did not change
direction, instead continuing straight to the top
boundary, and then back to its charging station. The
map shows us that the robot passed through the bottom right-hand area of the park without changing
direction whereas earlier in the night it had hit something there and changed direction.

BACKGROUND INFORMATION
The challenge of this task is to find a relationship between the obstacles within the park and the
robot mower’s behaviour. The behaviour of the mower is controlled by the rules and impacted by its
environment. Noticing where two (allegedly) identical situations yielded different behaviours by the
mower is key to finding the solution. This kind of reasoning is part of computational thinking and
incorporates pattern recognition, data representation, and data interpretation.
The robotic lawn mower in the task is controlled by a very simple program. The software of commercial
products might be smarter — some robots can move around objects on the lawn instead of just
randomly changing direction. Some very smart robots create a digital map of the lawn and move
systematically instead of randomly. Robotic lawn mowers are very practical but they also have some
drawbacks. For example, they can injure or kill smaller animals. They should therefore only be allowed
to operate during the day under human supervision.

49
This question comes from Years 3+4
Finland Years 5+6
Years 7+8

Viewer Numbers
Years 9+10 Easy
Years 11+12

Betty and Bobby Beaver publish videos on a popular online video service. The service informs them
each month how many viewers their videos have attracted. Betty and Bobby feel uncomfortable about
outsiders seeing this information, so they receive the number of viewers as a secret message.

The message consists of cat ( ) and dog ( ) symbols and can be converted into a number
with the help of a code table that tells which symbol combination corresponds to which digit.

Below is the code table used by Betty and Bobby:

0: 1: 2: 3: 4:

5: 6: 7: 8: 9:

Betty and Bobby recieve the message below, telling them the number of viewers they had last month:

Question
How many viewers did Betty and Bobby’s videos get last month?
Answer:

EXPLANATION

Answer
The answer is 417511, as shown by the below method of partitioning the complete message into
individual digit codes:

4= 1= 7= 5= 1= 1=

Explanation
The answer is most easily found by considering the message right to left. Moving this way, there is only
one candidate for the correct code at each step of the process. This is because the digit codes in the task
are “suffix-free” - This means that none of the digit codes can be found at the end of other digit codes.
We can also work left to right to find the answer, but the digit codes are not “prefix-free” - Some of the
digit codes used are found at the start of other digit codes.

For example, the code for 1 ( ) can be found at the start of the code for 0 ( ).
Continued on next page
50
This question comes from Years 3+4
Finland Years 5+6
Years 7+8

Viewer Numbers – continued


Years 9+10 Easy
Years 11+12

This means that it may take several attempts to find an answer, as using some of the code patterns will
mean reaching a point where the next symbols do not make up a digit code.
For example, one could first try to decode the first digit as a 3, but the next symbols do not allow a
match with any of the digit codes.

BACKGROUND INFORMATION

The digit codes in the task are essentially binary codes, where each symbol is either a cat or a dog. This
is analogous to binary codes used in computing where each symbol is either 0 or 1. All data processed
by digital computers is represented as binary codes. For example each character, including the digits
0-9, is represented by a binary sequence so that it can be stored on a computer.
The digit codes in this task were also an example of a variable-length character encoding. This refers to
a kind of encoding where the codes for different characters may have different lengths. For example,
the code for digit 0 consists of 4 symbols whereas the code for digit 1 consists of 3 symbols. Variable-
length codes are used widely in real applications. For example, compression algorithms (zip etc.) use
variable-length codes, and the very common UTF-8 character encoding is in itself a variable-length (or
variable-width) code.
As the digit codes in the task were “suffix-free”, decoding the message was more simple working from
right to left. In practice variable-length codes are usually inspected from left to right (or beginning
towards end) and are hence designed to be prefix-free. Such codes are commonly called prefix codes.

51
This question comes from Years 3+4
Croatia Years 5+6
Years 7+8

Encrypted Path
Years 9+10 Easy
Years 11+12

Beaver Bela has described the path that she and her friends take from school (S) to her house (H). The
path is shown in a square grid and described by using codes. The path they take goes past her friends’
houses, so that they can go home as well. Her friends’ houses are marked on the grid with numbers
from 1 to 8. The houses are shown in the code with an asterisk ¨*¨.
The letters used in the code are as follows:
U - is up
D - is down
L - is left
R - is right
The number of squares to move is written first, followed by the letter that determines the direction. For
example, “4D” means “four squares down”

Question
Which code represents the drawn path?

3R1D*2D*3L1U1L*1L1D1L*3U*3U*3R*1R1D1R*2R2U

3R1D2D*3L1U1L*1L1D1L*3U*3U*3R1R*1D1R*2R2U

2R1D*2D*3L1U1L*1L3D1L*3U*3U*3R*1R1D1R*2R5U

3R*1D2D*3L1U1L*2L1D1L*3U*3U*3R*1R1D1R*2R2U

Continued on next page


52
This question comes from Years 3+4
Croatia Years 5+6
Years 7+8

Encrypted Path – continued


Years 9+10 Easy
Years 11+12

EXPLANATION

Answer
The correct answer is 3R1D*2D*3L1U1L*1L1D1L*3U*3U*3R*1R1D1R*2R2U (option A).

Explanation:
We can see that each answer starts with a different sequence before the first asterisk, which
denotes the house. We can use this section alone to rule out the incorrect answers without further
investigation.
3R1D2D*3L1U1L*1L1D1L*3U*3U*3R1R*1D1R*2R2U has 3 squares right, 1 square down and 2 squares down
before the first asterisk. This is incorrect because this path will skip house 1 completely and stop for the
first time at house 2.
2R1D*2D*3L1U1L*1L3D1L*3U*3U*3R*1R1D1R*2R5U has 2 squares right and 1 square down before the first
asterisk. This path will stop for the first time on the square next to house 1. This is incorrect because
asterisks are intended to indicate houses.
3R*1D2D*3L1U1L*2L1D1L*3U*3U*3R*1R1D1R*2R2U has 3 square right before the first asterisk. This path
will stop for the first time on the square directly above house 1. This is incorrect because asterisks are
intended to indicate houses.

BACKGROUND INFORMATION
Debugging programs is one of the most important jobs for programmers. One method is to insert
breakpoints into the program and check that there have been no errors up to this point.
In the proposed problem, you need to compare four long codes. However, there are asterisks inside
the code that allow you to break the code apart, describing the movement in distinct parts - movement
from one house to another. If you compare the codes in such parts, you will quickly find erroneous
codes that do not match up with the given route.

53
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Fruit Stack
Years 9+10 Medium
Years 11+12

A family of four prepares breakfast for the next day. They pile up four boxes, each filled with a
different fruit:
apple , pear , orange , or strawberry .
As they are sleepy in the morning, they all just grab the box off the top of the pile. They do not know
in which exact order they will get to the pile of boxes, but the mother always gets there before the
daughter, and the father is always last.
Each of the four like and dislike different fruits. Fruits they like are marked below with a tick and fruits
they dislike are marked with a cross:

Father

Mother

Daughter

Son

Question
Drag the fruits into the boxes so that everyone is guaranteed to get a fruit they like.

Continued on next page


54
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Fruit Stack – continued


Years 9+10 Medium
Years 11+12

EXPLANATION

Answer
There is only one correct solution:

Explanation
We first look at what the father wants. He only likes oranges and will be the last one to reach the
boxes. Therefore, we need to put oranges into the box at the bottom so he is guaranteed to get a fruit
he likes.
Because we know that the mother will be taking her box before the daughter gets up, the mother is
either the first or the second one to take a box.
For the same reason, the daughter is the second or third one to take a box. The son can be first,
second, or third.
To summarize, the following three arrival orders are possible:

1st Mother Mother Son

2nd Son Daughter Mother

3rd Daughter Son Daughter

4th Father Father Father

We see that the second one to get up can be either the son, daughter, or mother. This means that the
fruit in the second box from top must me something that they all like.
Looking at the table of options, the only option that all three enjoy is the apple. (Second row in the
table below.)

Continued on next page


55
This question comes from Years 3+4
Austria Years 5+6
Years 7+8

Fruit Stack – continued


Years 9+10 Medium
Years 11+12

So we are left with two choices for the topmost box - pear and strawberry. This box can be taken by
either the mother or the son. The mother does not like pear. Therefore we have to put strawberry into
the first box, which the son also likes. (First row in the table below.)
We can now put pear into the third box, which both the son and daughter like.
(Third row in the table below.)
In summary, we have the following options for the order of the family members arriving, which gives
us the order of fruits shown below.

1st Mother or Son

2nd Daughter or son or


mother

3rd Daughter or son

4th Father

BACKGROUND INFORMATION
One of the first things computer scientists learn is the importance of having everything correctly
sequenced and the need to understand the background information of the problem. Without knowing
exactly who will eat first, we need to organise the data to make the problem solvable. The actual order
used in this task is stack order, in particular “Last in, First out” or LIFO. The pile of boxes in the fridge is
what computer scientists would call a stack: a structure where only the item on top of the stack can be
accessed. Only after removing the top item does another one becomes available. Stacks are used very
frequently in programming.
The task asks to find a way of sorting of the fruits which will work under multiple possible conditions.
But there are some constraints, and not all possible orders of family members can occur. Solving such
constraint problems can be very difficult. Often the best idea to do so is writing and using a computer
program to solve the problem.
Logic is important in computer science and computer programming, which is why problems that help
students understand logic lay a good foundation for when they start creating computer programs.
Creating tables to display all possibilities (as shown in the explanation) is a good way to sort and
sequence the given data. The use of Boolean logic may also be useful by using AND, OR and NOT to
determine which data is useful in any given sequence. Students will start to understand conditionals
in programming too, such as ELSEIF, by solving computational problems like the one shown in this
question.
Once students have a good understanding of logic and how problems can be dealt with by following
and sequencing commands logically, they will be better placed to write their own computer programs
to solve problems with many variables. They will then be able to write programs to help deal with
stacks.

56
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Bird Migration
Years 9+10 Medium
Years 11+12

Three islands (Star , Donut and Diamond ) are separated by marsh. There are two birds, a
black heron and a white ibis, that are currently located at different points on Star Island. Now that
winter has come, the birds and want to migrate to Donut Island to find a warmer area to build their
nests.

The birds move according to the following rules:


• The black heron can fly over the marsh at a rate of 2 blocks per hour. Once it has flown for 4 blocks,
it must immediately land on an adjacent square of land. It cannot move again until it has rested on
this square for 1 hour.
• The white ibis can fly over the marsh at a rate of 4 blocks per hour. Once it has flown for 4 blocks,
it must immediately land on an adjacent square of land. It cannot move again until it has rested on
this square for 2 hours.
• Both birds can also walk on land at a rate of 1 block per hour.
• Each bird can only move left/right/up/down on the map shown below – they cannot move
diagonally.

Question
Which bird can migrate from Star Island to Donut Island the fastest, and what is the difference between
the fastest migration times between the birds?

The black heron is faster by 1 hour.

The white ibis is faster by 1 hour.

The black heron is faster by 2 hours.

The white ibis is faster by 2 hours.


Continued on next page
57
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Bird Migration – continued


Years 9+10 Medium
Years 11+12

EXPLANATION
Answer
The white ibis is faster by 2 hours.

Explanation
We must first find the fastest path for each bird, and then compare the times to find the faster of the
two paths.
The white ibis first flies 4 blocks towards the right from Star Island to Diamond Island, which takes 1
hour. After resting for 2 hours, it walks 1 block on land towards the right, which takes 1 hour. Finally, it
flies 4 blocks from Diamond Island to Donut Island, which takes 1 hour. The overall time for the white
ibis is 1 + 2 + 1 + 1 = 5 hours.
The black heron first walks 1 block downward on land, which takes 1 hour. From here, it flies 4 blocks to
Diamond Island, which takes 2 hours. After resting for 1 hour, the black heron walks 1 block towards the
right, which takes 1 hour. Finally, it flies 4 blocks to Donut Island, which takes 2 hours. The overall time
for the black heron is 1 + 2 + 1 + 1 + 2 = 7 hours.
Thus, the white ibis is arrives at Donut Island 2 hours faster than the black heron.
Note that for both birds the flight segments over the sea are the longest that they can fly without a
rest. This means that we can’t replace any of the (slower) walking segments with (faster) flying, as then
the flying range will not be sufficient to reach the next island. This in turn means that the total travel
times computed above are optimal.

BACKGROUND INFORMATION
This question looks at optimisation, which is the process of finding the most efficient solution to a
given problem. In this question, we need to find the most straightforward path from one island to the
next for each bird.
We also need to work with constraints, which are restrictions or limitations on our solutions or
methods. In this question, each bird has to take a period of rest after travelling a certain distance,
which limits how far each bird can travel continuously.
A physical example is the task of building the largest box possible using a given amount of material,
such as sheet metal. We want to maximise the volume of the box (optimisation), but we are limited by
the amount of material we have to work with (constraint).
A technological example is the task of a computer deciding how to allocate its memory to various tasks
at the same time. The computer has a set amount of memory (constraint), however it may want to
allocate memory across tasks in a way that improves performance for the user (optimisation).
Combining optimisation and constraints allows us to make the best use of limited resources, whether
that be conserving energy in the case of the migrating birds; sheet metal in the case of the largest box
problem; or memory in the case of the computer.

58
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Ada’s Marble Machine


Years 9+10 Medium
Years 11+12

Ada the engineer has been asked to create a sorting machine to sort marbles based on the following
aspects:
• size (small or large)
• colour (red or yellow)
• material (stone or metal)
• decoration (glitter or mosaic).
Ada knows that marble designs have the following restrictions:
1. each marble can only be of one size, one colour, one material, and one decoration
2. marbles made of metal cannot be large-sized
3. marbles made of stone cannot be red
4. the glitter decoration cannot be applied to large marbles
5. the mosaic decoration cannot be applied to red marbles

Question
What is the largest possible number of uniquely designed marbles?

4 6 8 16

EXPLANATION
Answer
The answer is 6!

Explanation
One way to work this answer out is to examine all combinations of the different marble traits,
and eliminate the ones that are not possible. With the 4 traits we are given, and applying the first
restriction, there are a total of 16 possible types of marble.
When we apply the second restriction, we eliminate 4 marbles:
• Large Red Metal Glitter
• Large Red Metal Mosaic
• Large Yellow Metal Glitter
• Large Yellow Metal Mosaic
This leaves us with 12 uniquely designed marbles remaining.
Applying the third restriction, we eliminate the another 4 marbles:
• Small Red Stone Glitter
• Small Red Stone Mosaic
• Large Red Stone Glitter
• Large Red Stone Mosaic
This leaves us with 8 uniquely designed marbles remaining.

Continued on next page


59
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Ada’s Marble Machine – cont’d


Years 9+10 Medium
Years 11+12

Applying the fourth restriction, we eliminate the following marbles:


• Large Red Stone Glitter
• Large Red Metal Glitter
• Large Yellow Stone Glitter
• Large Yellow Metal Glitter
This time, however, we have already eliminated three of these options with previous restrictions, and
the only one remaining to be eliminated by this restriction is Large Yellow Stone Glitter. This leaves us
with 7 options remaining.
Applying the fifth restriction, we eliminate the following options:
• Small Red Stone Mosaic
• Small Red Metal Mosaic
• Large Red Stone Mosaic
• Large Red Metal Mosaic
Once again, we have already eliminated 3 of these options with previous restrictions, leaving only 1
remaining to be eliminated. Small Red Metal Mosaic is elimiated by this restriction, leaving us with 6
potential marble designs.

BACKGROUND INFORMATION
This question looks at sorting, which is the process of categorising objects based on given criteria.
There are four criteria that we can use to sort the marbles by (size, colour, material, decoration), either
alone or in combination.
We also need to work with constraints, which are restrictions or limitations on our solutions or
methods. In this case, there are 5 restrictions which are applied to the marble designs. When these
restrictions are combined, not all design options are possible.
A digital example of sorting with constraints is using filters to find subsets within a given data set. This
can occur in spreadsheets, where a filter can be applied to omit/select certain rows. This can also occur
in search results – such as from a search engine or online shopping interface – where a filter can refine
the results to match desired criteria.

60
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Audit Committee
Years 9+10 Medium
Years 11+12

City council members usually have different relationships with each


other - they can be colleagues from work, relatives, members of the same
political party, business partners. The city council of the Bebras city has
11 members whose relationships are described in a graph. Points mean
members and lines mean relationships (full lines means colleagues or
relatives, dashed lines political or business partners).
A city council has its own audit committee consisting of some members
of the council, which controls the management. Its members must not
have relationships with anyone else on the audit committee.

Question
How many members can the audit committee in Bebras city have at most?

2 3 4 5

EXPLANATION
Answer
Correct answer is B) 3.

Explanation
For greater convenience, we name the points with letters. We can count that four lines go out from
each point.
For example, the point C only has relationships with A, B, D, E.
We can start to choose the audit committee anywhere because the diagram does not have any special
points.
If we choose a member A, the next nearest member without relationship with A counterclockwise is D.
The next one without relationship with D is G and then the next such one is J. But J has a relationship
with A so J can’t be in the audit committee. Only 3 members A, D, G are independent in this case.
We get the same number of audit committee members when starting in any point and go any
direction, and it is therefore not possible to have more than 3 members in this committee.

BACKGROUND INFORMATION
The relationships among city council members are modeled with a graph. This consists of nodes
(representing some persons/objects, and usually depicted as points) connected in pairs by edges
(usually depicted as lines connecting points). Both the diagram in the task and the diagram in the
explanation depict the same graph.
A graph is an abstract structure and is useful when one wants to focus on the connections: the graph
emphasizes the important features (who is in relation with whom) but omits non-important details
(what are the persons/objects involved, what relation connects them).
Computers can work very effectively with graphs, so computer scientists have to understand graphs,
their types and properties very well.
Using the graph terminology, the task requires to find independent sets of the graph, i.e., subsets of
nodes in the graph, no two of which are connected by an edge. In particular here we are looking for
the independence number of the graph, which is the size of the largest maximum independent sets.
61
This question comes from Years 3+4
Italy Years 5+6
Years 7+8

Stacks of Tokens
Years 9+10 Medium
Years 11+12

Stephan placed seven stacks of tokens (light and dark red) on the table, as shown in the figure below.

A B C D E F G

He wants to put these stacks on top of each other without splitting them to form two perfectly equal
stacks; the resulting two stacks must have the same height (eight tokens) and the same sequence of
colors (from the bottom up).

Question
Possible stacks are represented below with a bracketed notation. (x, y, z, …) indicates that the stack is
made by placing y onto x, z onto y, and so on. Which of the following four pairs of stacks is NOT a valid
solution?

(A, F, B, G) and (E, D, C) (B, E, A) and (F, D, G, C)

(B, A, E) and (F, D, G, C) (B, E, A) and (F, D, C, G)

EXPLANATION

Answer
The right answer is: 3. (B, E, A) and (F, D, G, C).

Explanation
The other answers are all valid solutions to the proposed problem.
Since there are 16 tokens, of which 8 are white and 8 red, each of the two resulting stacks must be
made up of 4 white and 4 red tokens. Of the four stacks A, B, C, and D (3 tokens high), two must be in
one stack and the other two in the other stack. Examining the 3 token high stacks, we can see that we
cannot put A and C in the same stack, and similarly we cannot put B and D in the same stack. Either of
those combinations would make it impossible to balance the colors (two white tokens would need to
be added to the pair A-C, and two red tokens to the pair B-D). It can also be shown that putting A and D
in the same stack (and B and C in the other stack) does not lead to any result.
The quickest way of finding the solution in this case is to examine the top and bottom of each stack.
Since none of the 3 token stacks are identical, any solution which uses one of the 3 token stack on the
top (or bottom) of both parts of the final answer is incorrect. Since the incorrect result has A and C at
the top of the two stacks, we can quickly compare those two stacks and see that the top of each stack
will be different.

Continued on next page


62
This question comes from Years 3+4
Italy Years 5+6
Years 7+8

Stacks of Tokens – continued


Years 9+10 Medium
Years 11+12

BACKGROUND INFORMATION
Imagine you have a bag with a lot of coins and you want to divide them into two parts of equal value.
If all the coins had the same value and were even in number, then the problem would be easily solved:
it would be enough to divide them into two heaps that have the same number of coins; but if the coins
have many different values, then the task becomes a little more difficult.
In “more mathematical” terms, the partition problem is to decide whether a multiset (i.e., a set with a
multiplicity for each element) of positive integers can be partitioned into two sub-multisets such that
the sum of the numbers in the first sub-multiset equals the sum of the numbers in the second sub-
multiset. This problem (in general) is NP-complete (i.e., in practice, there is no known procedure for
solving it that is efficient in any case); but it can be solved using a pseudo-polynomial time algorithm,
based on dynamic programming.
Our task (in general) is certainly not simpler than solving a partition problem: in fact, it is not enough
that the height of the two resulting stacks is the same, but the color sequence of the tokens must
also be the same. A brute force method can however be implemented through an exhaustive search
algorithm.
In the case of our task, let’s list all the subsets of the seven stacks for each of which the sum amounts
to eight tokens: {A, B, E}, {A, B, F, G}, {A, C, E}, {A, C, F, G}, {A, D, E}, {A, D, F, G}; here we can stop, since
continuing we would find the complements of these already listed sets. Moreover, we can eliminate
the sets {A, C, E} and {A, C, F, G}, since the stacks that belong to them have a total of five red tokens.
Therefore, only four sets remain; for each of them and the respective complement, it is now a question
of trying all the possible stackings, in order to verify if any of these produces two identical stacks… In
our case, the set {A, B, E} leads to two solutions, while the set {A, B, F, G} leads to only one solution,
and the last two sets to none. It is then understood that the time required by this procedure grows very
quickly as the initial number of stacks (only seven, in our case) increases.

63
This question comes from Years 3+4
Austria Years 5+6
Years 7+8

Truchet Tiles
Years 9+10 Hard
Years 11+12

The following patterns have been created from lining up square tiles. Each pattern has been created
using a single type of tile - these four tiles are also shown below.

Question
Match each square tile to its corresponding pattern.

EXPLANATION
Answer

Explanation
The best way to find the correct answer is to look at where the lines on the tiles would meet.
In the pattern on the left, we see one continuous wavy line. So the lines in the tiles that make this
pattern would need to be curved and intersect in the middle of the edges of the tile. Of the two tiles
with curved lines, only one fits this criteria.

Continued on next page


64
This question comes from Years 3+4
Austria Years 5+6
Years 7+8

Truchet Tiles – continued


Years 9+10 Hard
Years 11+12

There is only one other pattern with curved lines so the remaining tile with curved lines has to be used
to create that one.
One of the remaining tiles has a dark colour right in some of its corners. By looking at the corners in
the remaining two patterns, only one of them has the same dark colour there - they appear like dots or
small triangles. This tile and pattern can therefore be assigned to each other.
Now only one tile and one pattern remain, so they have to go together.

BACKGROUND INFORMATION
These tiles are named after Sébastien Truchet who worked on variants of these tiles. Tiles with four of
the same sides form a subset of Truchet tiles (Truchet tiles don’t necessarily have to have four of the
same sides).
The fact that complex patterns can be created with very simple building blocks has fascinated people
for a long time. Truchet tiles are studied in mathematics and computer science, and they are used in
computer games to generate mazes or decorations.

65
This question comes from Years 3+4
Canada Years 5+6
Years 7+8

Spider Quilts
Years 9+10 Hard
Years 11+12

When Wanda sees an interesting web she uses it to design a new quilt.
She numbers the web’s anchor points from 1 to N and then arranges squares of fabric into an N-by-N
grid as follows:
• For every piece of silk, if its anchors are numbered X and Y, she places two crossed fabric squares in
her grid:
– One crossed fabric square is placed where row X and column Y meet.
– Another crossed fabric square is placed where row Y and column X meet.
• The rest of the grid is filled using solid fabric squares.
For example, the spider web on the left inspired the quilt on the right.

Wanda has now seen the following web and wants to use it to design a new quilt:

Continued on next page


66
This question comes from Years 3+4
Canada Years 5+6
Years 7+8

Spider Quilts – continued


Years 9+10 Hard
Years 11+12

Question
What will her quilt look like?

EXPLANATION
Answer

Explanation
The web has silk joining anchor point 1 with anchor points 3, 5, and 6. So the first row of the quilt will
have crossed fabric in columns 3, 5, and 6.
The web has silk joining anchor point 2 with anchor points 4 and 7. So the second row of the quilt will
have crossed fabric in columns 4 and 7.
The web has silk joining anchor point 3 with anchor points 1 and 6. So the third row of the quilt will
have crossed fabric in columns 1 and 6.
The web has silk joining anchor point 4 with anchor points 2, 6, and 7. So the fourth row of the quilt will
have crossed fabric in columns 2, 6, and 7.
The web has silk joining anchor point 5 with anchor point 1. So the fifth row of the quilt will have
crossed fabric in column 1.
The web has silk joining anchor point 6 with anchor points 1, 3, and 4. So the sixth row of the quilt will
have crossed fabric in columns 1, 3, and 4.
The web has silk joining anchor point 7 with anchor points 2 and 4. So the seventh row of the quilt will
have crossed fabric in columns 2 and 4.

67
This question comes from Years 3+4
Canada Years 5+6
Years 7+8

Spider Quilts – continued


Years 9+10 Hard
Years 11+12

is incorrect because it is missing crossed fabric in row 1 column 6 and in row 6 column 1.

is incorrect because it has crossed fabric incorrectly placed in row 1 column 1, row 4
column 4, and in row 7 column 7.

is incorrect because the entire quilt pattern is rotated 90 degrees. We can eliminate this
option by recognising that this method of creating a pattern will always create a line of
symmetry in the pattern, running from (1,1) to (7,7). This pattern does not have such a
line of symmetry and can quickly be discarded.

BACKGROUND INFORMATION

The spider web can be considered as a graph, a concept that is often used in computer science.
A graph is composed of vertices (the anchor points of the web) and edges (the pieces of silk between
two anchor points). Graphs are used to represent objects and the relationships between objects. For
example, a graph could show people who are friends on social media, or flights between countries.
In this task, Wanda’s quilt demonstrates an alternative way to represent a graph, known as an adjacency
matrix. Adjacency matrices are useful representations since they provide an efficient way to answer
questions about the structure of a graph. For example, ‘does a particular edge exist?’ and ‘how many
edges connect to a given vertex?’

68
This question comes from Years 3+4
Slovenia Years 5+6
Years 7+8

Jumping Jack
Years 9+10 Hard
Years 11+12

Jack the monkey lives in a park. He can jump from one tree to
another if it is either up to two cells away horizontally or vertically,
or one cell away diagonally, as shown in the diagram on the right.
Jack plays a game in which he jumps to as many different trees as
possible without touching the ground. He can start from any tree
in the park.
In the interactive map below you can click on a tree to change it
from one type to another.

Question
Find the biggest number of trees Jack can visit in one go without
touching the ground and change them to orange square trees.

Continued on next page


69
This question comes from Years 3+4
Slovenia Years 5+6
Years 7+8

Jumping Jack – continued


Years 9+10 Hard
Years 11+12

EXPLANATION
Answer Explanation
In the diagram below, the groups of trees that
Jack can visit without touching the ground have
been coloured in different colours.

There are six groups of trees in the park. If Jack starts on a tree coloured in yellow, he can reach all the
yellow trees, and no trees of other colours. How do we find such groups? Pick a random tree and colour
it in a certain colour. Then use the same colour for all trees that are reachable from it. And all trees that
are reachable from those trees, too. And so on, until you cannot reach any other trees. If there are any
trees that haven’t been coloured yet, take another colour and start again from a random uncoloured
tree. This colouring simulates Jack exploring.
The largest group of trees is the dark blue one, which contains 8 trees. The dark blue cluster is the
correct answer.

BACKGROUND INFORMATION

From the point of view of computer science, this question


involves manipulating a graph: the trees are called vertices,
and two trees are connected with an edge when Jack can jump
between them. In the diagram below, the edges are as purple
lines between trees.
If there is a path using these edges that allows Jack to go from
one tree to another, then these two trees belong to the same
group. These groups are called the connected components of
the graph. Here a different colour is used to represent each
connected component.
The procedure for colouring is similar to a number of different
graph algorithms that deal with searching: breadth-first search
and depth-first search.

70
This question comes from Years 3+4
the United States Years 5+6
Years 7+8

Still Life
Years 9+10 Hard
Years 11+12

There is a selection of fruit consisting of a column of red apples, a


column of yellow apples, a column of yellow bananas, and a column
of red strawberries.
A painter has chosen one piece of fruit to paint from the selection.
You are trying to work out which piece of fruit the painter has
chosen by asking them yes or no questions.
The painter will answer every question truthfully.
You want to find out which piece of fruit they have chosen in as
few questions as possible. The most efficient strategy minimises
the number of questions asked regardless of what piece of fruit the
painter has actually chosen.

Question
Which of the following questions could be the first one asked as part of the most efficient strategy
described above?

Is the fruit a banana?

Does the fruit have a bite taken out?

Is there a worm in the fruit?

Is the fruit yellow?

EXPLANATION
Answer
The most useful question to start with is: “Is the fruit yellow?”

Explanation
This question will eliminate half the fruit with a single question. All fruits of one colour will be
eliminated, leaving 8 fruit regardless of which answer the painter gives. This guarantee of eliminating
half the fruit is the best outcome of any of the question options.
The second question would be: “Is the fruit a banana/apple/strawberry?” which will again cut the
number of fruit left in half, with 4 remaining of one kind of fruit.
The third question will be: “Does the fruit have a bite taken out?”
And with one last question we will know exactly which fruit the painter will choose. We will only need
4 questions, regardless of which piece of fruit the painter chose.

Continued on next page


71
This question comes from Years 3+4
the United States Years 5+6
Years 7+8

Still Life – continued


Years 9+10 Hard
Years 11+12

The remaining three options are not correct because while they may reduce the number of questions
for some choices, they are less efficient for other choices and therefore are not part of the most efficient
strategy:
• Option B is not correct because you will only eliminate 4 fruits (the bananas) if the answer is no.
You could potentially need 5 questions in total to get to the right fruit.
• Option C is not correct because you will only eliminate 4 fruits if the answer is no.
You could need as many as 6 questions to get to the right fruit.
• Option D is not correct because you will only eliminate 1 fruit if the answer is no.
You could need 5 questions in total to get to the right fruit.

BACKGROUND INFORMATION

This question is about expert systems. Expert systems are systems that have a lot of knowledge about
a specific topic. An expert system will use previous knowledge and ask questions that help to find the
solution to a certain problem as fast as possible. The first expert system was built in the 1970s. They
are the first successful form of artificial intelligence (AI). In this task, the person asking questions is
the expert system. Asking questions to the painter, together with the known possibilities, will give the
desired information as fast as possible.
You could obviously ask ‘Have you chosen this piece?’ for each individual piece of fruit, but it could take
you up to 16 questions! If you ask smarter questions, you can find your solution much faster. Remember
that you don’t know beforehand what the painter will answer, so you are not trying to ask questions
based on guesswork. Instead, you are trying to ask questions so that both answers will eliminate as
many fruits as possible.
If you ask a question where half the objects fit the description, and the other half does not, you will
guarantee that half the number of possibilities will be eliminated no matter what the answer to the
question is.
If you ask a question where only one object fits, you have a 1/16 chance to have the correct object now
(1 object left), but a 15/16 chance to have 15 objects left. This tactic requires an average of 8 questions
to find the correct piece of fruit, which is far less efficient than the 4 questions needed in the strategy
outlined in the answer.

72
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Playing with Hats


Years 9+10 Hard
Years 11+12

A beaver likes to play a game by placing circular pebbles on square paving stones.
The beaver moves from left to right, one square at a time .
The beaver has a hat and behaves differently depending on whether they have the hat in their hand or
on their head.
The rules that the beaver follows are listed below:
• If the beaver has the hat in their hand and steps on a square with no pebble, they continue on with
no change.
• If the beaver has the hat in their hand and steps on a square with a pebble, they take the pebble and
put the hat on their head before moving to the next square.
• If the beaver has the hat on their head and steps on a square with no pebble, they place a pebble on
the square and take the hat off before moving to the next square.
• If the beaver has the hat on their head and steps on a square with a pebble, they continue to the
next square with no change.
The pictures in the table below show the rules of the game. The changes for each situation are shown
“before after”.

Rules:

Continued on next page


73
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Playing with Hats – continued


Years 9+10 Hard
Years 11+12

At the beginning, the beaver has the hat in their hand and three pebbles are on the squares in the
positions shown below.

Question
Show which squares have pebbles on them after the beaver has moved over all of them and left the
last square.
Click on the squares below to place or remove a pebble.

EXPLANATION
Answer

Explanation
The solution can be found by step-by-step analysis.
We show this in this picture, using the rules below:

Continued on next page

74
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Playing with Hats – continued


Years 9+10 Hard
Years 11+12

BACKGROUND INFORMATION
The beaver has two states:
• hat in hand
• hat on head
Depending on its state, the beaver behaves differently. The beaver with its rules behaves like a
Turing machine. A Turing machine is a useful model for computation in computer science. Although it
is very simple, it is as powerful and as efficient as any programming language. This means any software
program can be converted into a Turing machine and, conversely, any Turing machine into a program.
It was first described in 1936 by the English mathematician and computer scientist Alan Turing. Turing
machines are one of the most important formal models in computer science.
A Turing machine has various necessary components:
• A long tape divided into squares. Normally it is said to be infinite.
• A finite alphabet of symbols, e.g., 0, 1. In our example we used a pebble and no pebble.
• A read/write head: this would be able to look at a square and read its symbol. After reading and
proceeding according to the rules the head would then move left or right one square at a time. In
our case the beaver represents the read/write head.
• A finite set of states: we used two states: hat in hand and hat on head.
• A set of rules (transition rules): to specify how the machine operates (see task description).

75
Bebras Challenge
2022 Round 1

Years 11+12
This question comes from Years 3+4
Belgium Years 5+6
Years 7+8

Vaccination Centres
Years 9+10
Years 11+12 Easy

People from a region consisting of six main cities are in the process of getting vaccinated. Due to
resource limitations, only two cities can be equipped with a vaccination centre. The map below shows
the region and its cities, with the times needed to travel from one city to another (in hours). Not all
cities are directly connected by roads.
The cities where the two vaccination centres will be located should be chosen so that the time it takes
everyone to reach them from their own cities is as short as possible.
This should apply to all cities - this avoids the situation of reducing the travel time for some cities but
leaving other cities with long travel times.

Question
Given that one vaccination centre will be placed in the existing hospital in City F, where must the
second one be placed?
Select the city to place the centre.

Continued on next page


77
This question comes from Years 3+4
Belgium Years 5+6
Years 7+8

Vaccination Centres - cont’d


Years 9+10
Years 11+12 Easy

EXPLANATION

Answer
The correct answer is City B.

Explanation
Since one hospital is placed in City F, there are five possibilities to place the second one. For each
possibility, we have to check the minimum time needed to go from every city to any vaccination centre.
In the following table, the columns show each possible placement for the two vaccination centres and
the rows show the number of hours needed to reach the closest vaccination centre.

Minimum Locations of vaccination centres


time go from A and F B and F C and F D and F E and F
city...
A 0 2 3 3 5
B 2 0 1 2 3
C 2 1 0 1 2
D 3 2 1 0 2
E 1 1 1 1 0
F 0 0 0 0 0
Max 3 2 3 3 5

The last row shows the largest number of hours needed to reach a vaccination centre. Therefore,
placing the second one in City B is the best solution. People in each city would be able to reach a
vaccination centre in no more than 2 hours.

BACKGROUND INFORMATION
This task is related to the vertex k-center problem which can be solved by using an algorithm designed
by computer scientists. This type of problem can be represented as a graph - a set of nodes that can
be connected together with links that have a weight (cities and roads with travel time in this task).
The problem consists of choosing k nodes from the graph (2 in this task) so as to minimise the time/
distance from any node of the graph to any of the k selected nodes.
Such a problem is very common when trying to choose where to place facilities such as fire stations,
schools, police stations, etc. (or hospitals in this task). The criterion that has to be minimised can be the
time needed to reach the facilities, the distance to be travelled, or any other criterion that is available.

78
This question comes from Years 3+4
Czech Republic Years 5+6
Years 7+8

Secret of the Diary


Years 9+10
Years 11+12 Easy

Petra and Jana have found a secret diary of their classmate Lucie.
They think that she is concealing the name of her new puppy in
the diary. Unfortunately for them, Lucie has encrypted the text in
the diary using horizontal and vertical lines with the help of the
table of letters on the right. The two girls were only successful
in deciphering the name of Lucie’s brother, PAVEL, from the code
below:

Question
Uncover the name of Lucie’s puppy hidden in the code:

EXPLANATION
Answer
The name of Lucie’s puppy is JOSEF (noting that the answer is not case sensitive, so Josef and josef are
also accepted for example).

Explanation
The horizontal and vertical lines found in the encrypted symbols have meaning. The number of
horizontal lines corresponds with a row number in the table of letters. Similarly, the number of vertical
lines corresponds with a column number. The letter found where the row and column meet is the letter
encrypted by the symbol.
For example, the first symbol has 2 horizontal lines and 5 vertical lines. The letter found where
row 2 and column 5 meet is J.
Using this process for each remaining symbol, the name JOSEF can be decrypted.

BACKGROUND INFORMATION
Encrypting and decrypting text is a very important part of informatics. It is a common requirement for
communicating via the internet in order to be safe and in order for information to be secure.
The method of encryption used in this task is not used in common practice, but the task demonstrates
some common computational thinking skills. First, it requires logical thinking in order to discover the
relationship between the symbols and the letters. Second, it requires abstraction in order to identify the
important features. You may have noticed that the letter E is encrypted twice (once in PAVEL and once
in JOSEF) but the encrypted symbols look different. The length of the lines or where they cross is not an
important feature and can be abstracted away. What is important is the number of lines, and whether
they are horizontal or vertical.

79
This question comes from Years 3+4
Hungary Years 5+6
Years 7+8

Robo-Rally
Years 9+10
Years 11+12 Easy

Coraline and Tristan are playing a board game called Robo-rally.


Both players have a token on the board, and they direct their token’s movements by playing cards. The
cards specify one of the following movements:
• Move one space forward,
• Turn left (but stay on the same space),
• Turn right (but stay on the same space).

The cards must be arranged by the player in the order they wish the token to move.
Coraline and Tristan each choose 4 cards and then follow the
movement instructions in order, one card after the other. All tokens
move simultaneously. Tokens attempting to move into the same
space at the same time are resolved by priority numbers printed on
the cards.
The movement on the card with the higher priority number will be
executed first. If a player’s token needs to be moved to a space used
by the other token, the token on that space will be shifted in the moving token’s direction.

Caroline’s cards

Tristan’s cards

Continued on next page


80
This question comes from Years 3+4
Hungary Years 5+6
Years 7+8

Robo-Rally - continued
Years 9+10
Years 11+12 Easy

Question
Drag the tokens to their new positions on the board.
The arrows on the tokens below indicate the direction that they are initially facing.

EXPLANATION
Answer

Continued on next page


81
This question comes from Years 3+4
Hungary Years 5+6
Years 7+8

Robo-Rally - continued
Years 9+10
Years 11+12 Easy

Explanation
The position of the tokens can be determined by stepwise going through each of Coraline and Tristan’s
cards, and following the relevant rules.

The first move can be executed simultaneously. The tokens will be


moved one space forward.

The second move can be executed simultaneously, too, and the tokens
will turn - Coraline’s will turn to the left, and Tristan’s will turn to the
right.

For the third move, both tokens would be moved to the same space.
Tristan’s token moves first, because his card has the higher value (564).
Then Coraline’s token will move one space forward – this shifts
Tristan’s token one space in the direction that Coraline’s token moved.

Lastly, the tokens can turn simultaneously, giving the answer.

BACKGROUND INFORMATION
Some computer programs divide a larger task into smaller tasks . These programs let several processes
work on the smaller tasks at the same time, and mostly independently. This is called concurrent
execution of processes. During the concurrent execution, it is possible that a process needs to wait to
get access to a shared resource or to affect another process in some way. It is important to define rules
for coordinating the processes’ behavior in such situations - we saw this in the case where two tokens
needed to move into the same space at the same time.

82
This question comes from Years 3+4
Italy Years 5+6
Years 7+8

Snow White
Years 9+10
Years 11+12 Easy

The Seven Dwarfs are having an argument. For simplicity, Snow White now refers to them by numbers
which reflects who they are friends with:
• 12 is friends with 1 and 2,
• 13 is friends with 1 and 3,
• 23 is friends with 2 and 3, and
• 123 is friends with all.

Snow White has proposed a game to try and distract them. The game has the following five rules:
• If she shouts “2” - 2 comes into the house (or stay there) together with his friends 12, 23, and 123.
• If she shouts “3” - 3 comes into the house (or stay there) together with his friends 13, 23, and 123.
• If she shouts “4” - 1 and his friends change their individual positions: if they were inside the house
they go outside, and if outside they come back to the house.
• If she shouts “5” - dwarfs 2 and his friends change their positions.
• If she shouts “6” - dwarfs 3 and his friends change their positions.
For example, suppose 1, 2, and 12 are in the house while 23 and 123 are outside.
If Snow White shouts “5”, then 2 and 12 go outside, while 23 and 123 enter the house, and
1 stays in the house.

Question
All the seven dwarfs are now in the house, but Snow White would like to stay alone with the prince.
What is the shortest sequence of commands that she can use to send all the dwarfs outside?
Example: 6532 represents the sequence 6, 5, 3, 2.

Continued on next page


83
This question comes from Years 3+4
Italy Years 5+6
Years 7+8

Snow White - continued


Years 9+10
Years 11+12 Easy

EXPLANATION
Answer
42536 or 43625.

Explanation
Since there are no direct commands to send a particular dwarf out of the house, the best approach
is to dismiss the dwarfs through commands “4”, “5” or “6”. The problem is that some of them will be
called back using these commands if they are already out of the house, so Snow White needs to make
sure that every dwarf affected by the commands “4”, “5” or “6” are brought back into the house before
calling that particular command.
Because there is no direct way to call 1 and his friends back in the house, Snow White can start by
calling “4” and sending 1 and his friends out. This will leave 2, 3 and 23 in the house. At this point, some
friends of 2 and 3 are out of the house. Snow White can then call the combinations of “25” and “36”
in either order. Each combination brings either 2 or 3 and their respecitve group of friends back in the
house, and then sends that group of friends out together. The following tables shows the position
changes after every command:
• When Snow White calls 42536:

Command 4 3 6 2 5
Dwarfs inside 2, 3, and 23 2, 3, 12, 23, 3 3, 13, 23, and -
the house and 123 123
Dwarfs outside 1, 12, 13, and 1 and 13 1, 2, 12, 13, 23, 1, 2, and 12 1, 2, 3, 12, 13,
the house 123 and 123 23, and 123

• When Snow White calls 43625:

Command 4 3 6 2 5
Dwarfs inside 2, 3, and 23 2, 3, 13, 23, 2 2, 12, 23, and -
the house and 123 123
Dwarfs outside 1, 12, 13, and 1 and 12 1, 3, 12, 13, 23, 1, 3, and 13 1, 2, 3, 12, 13,
the house 123 and 123 23, and 123

BACKGROUND INFORMATION
The first item concerns data representation: dwarfs can be
represented as numbers, and these numbers conveniently also
represent friendships. Commands can also be represented as
numbers. The answer is also a number, representing a sequence of
commands - this answer sequence is a (very simple) program!
Friendships could also be represented by a simple graph, a sort of
centered hexagon where 123 is the centre and the edges represent
friendships.
More surprisingly, the illustrated problem also can be linked to
computer graphics. The dwarfs might represent intersecting regions
in a plane, which we want to colour with two colours (white=inside
the house, black=outside the house). This task then essentially becomes the study of the shortence
sequence of commands to colour the entire plane black.
84
This question comes from Years 3+4
Latvia Years 5+6
Years 7+8

Comfort Temperature
Years 9+10
Years 11+12 Easy

Every day, beaver Theophilus measures his lake’s water


temperature in some units, which he records in a table. He
records the first measurement immediately after waking up,
and the last one shortly before bedtime.
Theophilus knows that the temperature changes constantly, so
during the day he records only the extreme temperatures:
• a temperature where the previous measurements were
increasing, and immediately afterwards began decreasing,
or vice versa;
• a temperature where the previous measurements were
decreasing and immediately afterwards began increasing.
For example, if the temperature changed like in the adjacent
drawing, Theophilus would have written the numbers A, B, C,
D, E in the table. There is exactly one temperature value, the
“comfort temperature”, at which Theophilus feels best.

Question
What are the limits of the “comfort temperature” if the comfort temperature was met exactly five times
yesterday, and yesterday’s observations are the following:
5.1, 5.8, 5.5, 5.9, 5.3, 5.7, 5.4, 5.8, 5.6?
Select two correct options.

5.1 5.8 5.5 5.9 5.3 5.7 5.4 5.8 5.6

EXPLANATION
Answer
Between 5.4 and 5.5.

Explanation
Using the given data, we can build a graph similar to example
given in the task description. The graph looks something like
this:
We can then count the number of times where horizontal
lines intersect with the graph. We are looking for the range
of horizontal lines where there are five intersections with the
water temperature graph - this indicates the range where a
temperature was reached five times throughout the day, and
could therefore be a candidate for the “comfort temperature”.
These criteria correspond to the interval (5.4;5.5) (excluding
endpoint values), as depicted by the shaded grey region above.
Continued on next page
85
This question comes from Years 3+4
Latvia Years 5+6
Years 7+8

Comfort Temperature – cont’d


Years 9+10
Years 11+12 Easy

BACKGROUND INFORMATION
In this problem, students need to apply basic data analysis skills. While data visualization is very
helpful here, task can be solved also without it. For example, an approach could be using number
intervals, counting how many times a particular interval is covered (in other words, how many times a
temperature in that interval appear throughout the day), and adding new endpoints when they appear
in measurements.
This approach is shown below:
(5.1, 5.8) 1
(5.1, 5.5) 1; (5.5, 5.8) 2
(5.1, 5.5) 1; (5.5, 5.8) 3; (5.8, 5.9) 1
(5.1, 5.3) 1; (5.3, 5.5) 2; (5.5, 5.8) 4; (5.8, 5.9) 2
(5.1, 5.3) 1; (5.3, 5.5) 3; (5.5, 5.7)..5; (5.7, 5.8) 4; (5.8, 5.9) 2
(5.1, 5.3) 1; (5.3, 5.4)..3; (5.4, 5.5) 4; (5.5, 5.7)..6; (5.7, 5.8) 4; (5.8, 5.9) 2
(5.1, 5.3) 1; (5.3, 5.4)..3; (5.4, 5.5) 5; (5.5, 5.7)..7; (5.7, 5.8) 5; (5.8, 5.9) 2
(5.1, 5.3) 1; (5.3, 5.4)..3; (5.4, 5.5) 5; (5.5, 5.6) 7; (5.6, 5.7)..8; (5.7, 5.8) 6; (5.8, 5.9) 2

This strategy utilises segments, which are well-known data structures in computer programming and
are also used in various applications.

86
This question comes from Years 3+4
Uruguay Years 5+6
Years 7+8

Secret Number
Years 9+10
Years 11+12 Medium

In Bebravia payments are made with special coins. Each coin has its own value written in the centre.

A citizen of Bebravia has the four coins shown above, but the value at the centre of one of the coins is
rubbed out. However, each coin’s value can be worked out using the same set of rules. From this, the
citizen was able to determine the missing value.

Question
What is the missing value?

22 23 26 29

EXPLANATION

Answer
29.

Explanation
The value of each coin is calculated as following: sum of the numbers surrounding the central coin
value plus the number of sides the coin has. In this task there are four different coins:

Square: 3 + 5 + 6 + 2 + 4 = 20
Hexagon: 1 + 9 + 2 + 4 + 5 + 0 + 6 = 27
Triangle: 10 + 2 + 3 + 3 = 18
Pentagon: 5 + 2 + 3 + 8 + 6 + 5 = 29

A student attempting this might at first try to find a relationship between the numbers around the
outside and the value in the middle and, after failing to find a simple pattern (and remembering that
Bebras tasks do not require any mathematical knowledge beyond simple numeracy) go back to the task
and check they have extracted all of the data given. Looking for more data should enable the student
to notice that the coins have different numbers of sides and then quickly work out the pattern.

Continued on next page


87
This question comes from Years 3+4
Uruguay Years 5+6
Years 7+8

Secret Number – continued


Years 9+10
Years 11+12 Medium

BACKGROUND INFORMATION
The value of each coin is calculated as following: sum of the numbers surrounding the central coin
value plus the number of sides the coin has. In this task there are four different coins:

Square: 3 + 5 + 6 + 2 + 4 = 20
Hexagon: 1 + 9 + 2 + 4 + 5 + 0 + 6 = 27
Triangle: 10 + 2 + 3 + 3 = 18
Pentagon: 5 + 2 + 3 + 8 + 6 + 5 = 29

A student attempting this might at first try to find a relationship between the numbers around the
outside and the value in the middle and, after failing to find a simple pattern (and remembering that
Bebras tasks do not require any mathematical knowledge beyond simple numeracy) go back to the task
and check they have extracted all of the data given. Looking for more data should enable the student
to notice that the coins have different numbers of sides and then quickly work out the pattern.

88
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot


Years 9+10
Years 11+12 Medium

A robot starts from the position shown below and moves along the lines.

There are three symbols , and on the lines that decide the direction it should take at the
next intersection. The robot must not reach the .

Each symbol has a different meaning and could mean:

turn left at the next intersection, or

turn right at the next intersection, or

go straight at the next intersection

Unfortunately, we do not know which symbol means what.


The meaning of the symbol remains the same regardless of the direction the robot is moving.
For example, the arrow in the picture below shows how the robot would turn, coming from either
direction, if a triangle symbol meant “turn left”.

Continued on next page


89
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot – cont’d


Years 9+10
Years 11+12 Medium

Question
Help the robot reach by assigning correct meaning to the symbols.

EXPLANATION

Answer Explanation
The picture shows robot’s walk:

Continued on next page


90
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot – cont’d


Years 9+10
Years 11+12 Medium

We can use different strategies to solve the problems. One of them is going through every possibility.
In this task there are only 6 different ways to interpret the symbols (the pictures show all of them) and
only one of them leads to :

Another strategy is to trace the path the robot could take and assign meaning to symbols as we follow
the path. If the robot reaches the red flag or enters a loop, or the meanings cannot be applied to
symbols consistently, we retrace to the previous step (in this case intersection) and try another path.

Continued on next page


91
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot – cont’d


Years 9+10
Years 11+12 Medium

BACKGROUND INFORMATION
The first strategy proposed in the explanation is called brute force. This means to consider and check
every possibility until one finds the desired result. Sometime there can be many possibilities and
considering all of them could be very time consuming and therefore one need to find other strategies.
The second strategy is called backtracking. In this technique one incrementally builds candidates to the
solutions, and abandons a candidate as soon as one determines that the candidate cannot possibly be
completed to a valid solution. The advantage of backtracking with respect to brute force is that you do
not have to reconsider the new candidate solutions from the beginning, since you go back only to the
step where you made your last choice and continue on from there.
For the given problem brute force may work better, as we have few variables (symbols) and few paths
for the robot to take. However in general for larger complex problems, when the number of variables
increase and the paths to explore are more, backtracking provides better and elegant solution. Puzzles
like Sudoku can be elegantly solved using backtracking.

92
This question comes from Years 3+4
Ireland Years 5+6
Years 7+8

Cupcakes
Years 9+10
Years 11+12 Medium

Bebras Bakery produces cupcakes for the hard-working hungry beavers in the town. Each cupcake is
decorated with three sweet layers. Firstly, each cupcake gets an icing layer, then a toppings layer, and
finally a fruit layer. The first example below has red icing, chocolate flakes topping, and a cherry fruit
layer. The second example below has blue icing, toasted nuts topping, and a blueberry fruit layer.

On the assembly line, each of the layers is changed from one cupcake to the next as follows:
• The icing layer changes with the following pattern: green \(\to\) white \(\to\) red \(\to\) blue \(\to\)
[repeats again starting with green]
• The toppings layer changes with the following pattern: sprinkles \(\to\) chocolate flakes \(\to\)
toasted nuts \(\to\) [repeats again starting with sprinkles]
• The fruit layer changes with the following pattern: cherry \(\to\) kiwi \(\to\) strawberry \(\to\)
orange \(\to\) blueberry \(\to\) [repeats again starting with cherry]
Barry the Beaver plays a trick in the bakery. He changes the pattern of two of the layers:
• Barry changes the fruit pattern so that each time it skips the next two fruits in the pattern. For
example, if an orange piece is placed on a cupcake the next cupcake would have a kiwi piece on top.
• Barry reverses the toppings pattern.

Question
If the 1st cupcake has green icing, sprinkles, and a cherry on top, what will the 6th cupcake look like?

Red, chocolate flakes, cherry Blue, toasted nuts, strawberry

White, toasted nuts, kiwi White, chocolate flakes, cherry

Blue, chocolate flakes, blueberry

Continued on next page


93
This question comes from Years 3+4
Ireland Years 5+6
Years 7+8

Cupcakes – continued
Years 9+10
Years 11+12 Medium

EXPLANATION
Answer
White, chocolate flakes, cherry.

Explanation
An approach to find the correct combination is to methodically go through each of the topping orders
using the new rules.
The first cupcake has green icing, sprinkles, and a cherry on top. We need to find the 6th cupcake.
Starting with the icing layer the order is: green, white, red, blue, green, white - therefore the 6th has
white icing
Moving on to the toppings layer we know the Barry has reveresed the order here. The first cupcake has
sprinkles. The order is then: sprinkles, toasted nuts, chocolate flakes, sprinkles, toasted nuts, chocolate
flakes, - therefore the 6th has chocolate flakes
Moving on to the fruit layer. We know that Barry changes the fruit so that it skips the next two pieces
in the pattern after putting one on. We know the first one has a cherry on top. The order is then:
cherry, orange, kiwi, blueberry, strawberry, cherry, - therefore the 6th has a cherry layer.

BACKGROUND INFORMATION
This task illustrates the computational thinking concepts of algorithms and pattern recognition, and the
computer programming concept of a linked list. Pattern recognition is the concept of finding patterns
in the problem that can be followed to find the solution, either in the form of loops in the solution,
or reusing parts of solutions from previously solved problems. In this task, the sequence of options
for each layer forms a pattern, but also there is a pattern in the way that the application of each layer
(icing, toppings, fruit) follows the same fundamental algorithm.
An algorithm is a list of instructions. Following instructions is a very important concept in computer
science. This is how a computer works - we tell it what to do and it follows these steps. For some
programming languages, the order of instructions is very important also. By changing the order, we
can change the output of the program. The sequence of ingredients in this task is very important for
each layer.
When we write computer programs we need to store data within our program. We use data structures
to store data in an efficient and organised fashion. There are many different types of data structures,
such as the data structure most relevant for this task: a linked list. A linked list is a linear collection of
data elements where the order is not given by their physical position in memory. Instead, each element
points to the next element, and this allows us to access an given element within the list by traversing
the list from the start. Linked lists can dynamically increase in size and, unlike arrays, it is easy to insert
and delete anywhere within a linked list. For example, to delete an element anywhere in the list we
only need to change what the previous element in the list points to.

94
This question comes from Years 3+4
Latvia Years 5+6
Years 7+8

Bench Workshop
Years 9+10
Years 11+12 Medium

Beaver Albert makes benches. Each bench must have four legs of equal length. The benches come in a
variety of different sizes to suit different customer preferences.
Since Albert finds the materials for bench legs in the woods, he does not always manage to find legs
of the same length. In exceptional cases, Albert can shorten one or more legs to any length he wants.
When shortening a leg, the remainder from what Albert cuts off cannot be used. Albert currently has
the following 32 legs in stock:

Length 10 9 8 7 6 5 4 3 2
Count 3 6 3 3 5 3 3 2 4

Question
What is the minimum number of legs that must be shortened to form eight benches?

EXPLANATION
Answer
The correct answer is 6.

Explanation
When summing up the total number of legs, we can observe there is a count of 32. This means that
every leg will need to be used to create 8 benches.
With this in mind, there are two non-obvious rules to get the optimal solution for the case when all
legs should be used:
• Rule 1: If the count of legs for a length is greater than 4, then create as many benches as possible
from that length.
If there are already enough legs at a particular length to make a bench, then shortening them will
require at least 4 shortenings for no gain in the number of benches created. Excessive shortening of
4-leg sets therefore cannot be optimal.
Applying Rule 1 to Albert’s current stock creates 3 benches at lengths 9, 6 and 2, respecitvely.
When we take away all those sets, the count is as follows:

Length 10 9 8 7 6 5 4 3
Count 3 2 3 3 1 3 3 2

Continued on next page


95
This question comes from Years 3+4
Latvia Years 5+6
Years 7+8

Bench Workshop – continued


Years 9+10
Years 11+12 Medium

We can now apply the second rule:


• Rule 2: All legs of the same length are either used to make a bench or are shortened.
This rule is obvious for the longest and shortest legs. In our case, legs of length 10 should all be
shortened since there are no legs which can be shortened to this length, making it impossible to create
a bench of length 10. Conversley, all legs of length 3 will be used to make bench since they cannot be
shortened any further.
The number of additional legs needed for each length are as follows:

Length 10 9 8 7 6 5 4 3
Count 3 2 3 3 1 3 3 2
Legs to
0 2 3 3 1 3 3 2
be added

Legs of at least three different lengths need to be shortened ‑ by shortening legs of just two lengths it
is impossible to get the necessary total number of legs to be added (3+3 < 2+1+3+1+1+2).
The least number of legs from three lengths are 6 - from lengths 10, 9 and 6. We include length 10 here
as ‘0 legs to be added’ and omit length 3 due to Rule 1.
Shortening legs with length 6 to length 5 completes a 4-set of legs with length 5. Using the five longest
legs with length 10 and 9 allows Albert to complete 4-sets of legs 8, 7, 4 and 3. So, in the optimal
solution 6 legs should be shortened.

BACKGROUND INFORMATION
An optimal solution is a feasible solution where the objective function reaches its maximum (or
minimum) value – for example, the most profit or the least cost. A globally optimal solution is one
where there are no other feasible solutions with better objective function values. A locally optimal
solution is one where there are no other feasible solutions “in the vicinity” with better objective
function values – you can picture this as a point at the top of a “peak” or at the bottom of a “valley”
which may be formed by the objective function and/or the constraints.
Dynamic Programming (DP) is an algorithmic technique for solving an optimisation problem by
breaking it down into simpler sub-problems and utilising the fact that the optimal solution to the
overall problem depends upon the optimal solution to its sub-problems. Optimisation problems are
widely proposed and needed in many computing fields which make it a very important concept. DP
comes in handy when dealing with such problems to give nice solutions with reasonable complexity,
which makes it a very important algorithm to know. This problem is a great example for both concepts
as students explore the idea that the optimal solution is not always obvious, and often cannot be found
using a greedy algorithm. This emphasises the importance of algorithms and programming.

96
This question comes from Years 3+4
the United Kingdom Years 5+6
Years 7+8

Burrow Business
Years 9+10
Years 11+12 Medium

In a field divided into an \(8 \times 8\) grid, badgers and rabbits have been randomly
assigned burrows:

In the diagram left, B = a badger, and r = a rabbit.


The badgers and rabbits get along well with each other. However,
if a badger or a rabbit finds themselves in a burrow where
there are less of their own kind next to them, then given the
opportunity, they will always choose to move.
Examples:
• A badger with none of the eight surrounding squares occupied
will stay where they are.
• A badger with one badger and one rabbit next to them and 6
unoccupied squares will stay where they are.
• A badger with one badger and two rabbits will choose to move.

The Burrow Officer is trying to organise the field to satisfy all inhabitants, and has the following
moving rules:
1. All badgers are asked if they want to move, starting with the one nearest the top left of the field and
working across the field and down a row at a time. When all the badgers have made their moves, all
the rabbits are asked if they want to move, in the same way.
2. When a badger or rabbit wants to move, they do so immediately but they have to move to the first
available square that satisfies their wishes about who can be next to them. The first available square
means looking for squares starting at the top left and working across and down.
3. All badgers and rabbits are only allowed to move once.

Question
After all the badgers and rabbits have moved, which of these fields shows the correct pattern?

A. B. C. D.

Continued on next page


97
This question comes from Years 3+4
the United Kingdom Years 5+6
Years 7+8

Burrow Business – continued


Years 9+10
Years 11+12 Medium

EXPLANATION
Answer

Explanation

A. B. C. D.

Option A is correct. This is a result of following the given algorithm.


Some care is required because later animals move into empty spaces near the top, which makes the
layout fairly dynamic. A human can work out a general layout is fairly easily, but finding the exact result
is computationally hard.
As this is multiple-choice there is no need to completely work out the correct answer or even check
each of the provided answers completely. It is enough to find any placement that cannot be generated
by the algorithm and thus disprove the wrong answers.
To find the answer using this approach, we only need to look at the top left square which starts with a
rabbit.
Since rabbits move after badgers, a badger cannot end up in this square. That rules out C and D. We
then need to determine if the rabbit would stay or move.
Working across the top row the first Badger stays where it is. The second one chooses to move as it
only has one neighbour and this is a rabbit. The first available and suitable space is the second square
on the top row next to the first rabbit. This now means that once all the badgers have moved the rabbit
in the top left square will choose to move, leaving the square empty. No other rabbits will move into
it because it is now unsuitable, having badger neighbors but no rabbits. The only answer with the top
left square empty is answer A.

Continued on next page


98
This question comes from Years 3+4
the United Kingdom Years 5+6
Years 7+8

Burrow Business – continued


Years 9+10
Years 11+12 Medium

The other options come about through variations of the rules:


• Answer B is simply assigning burrows in an alternating fashion, but this is not what was asked for.
• Answer C is a result of asking each badger or rabbit to move working from the top left down to
the bottom of the field a row at a time. There are badgers who have moved to places with starting
rabbits, which cannot happen if the algorithm is followed.
• Answer D is a result of asking all the rabbits to move first instead of the badgers. Otherwise all the
rules were met.

BACKGROUND INFORMATION
The challenge in this question is about following an algorithm. It is based based on Schelling’s
segregation model. This is a program that models social outcomes given particular choices, namely
about where people will live given reasonable choices. It is more sophisticated than the model used
in this question and demonstrates that two groups of people will naturally segregate into separate
communities without exhibiting prejudice but simply by wanting to have people like them relatively
near them. This helps to explain why we have concentrated communities in many cities around the
world – groups of people who have the same religion, culture, or even wealth can often be found all
living together in areas of a city. If an estate agent chooses to “save themselves some time” by making
assumptions and, for example, only offering houses to rich people in areas where most rich people
already live, this will make segregation even more extreme.
Although the model used in the question is very simplified it can be seen that using any of the systems
in answers A, C or D result in segregation. Only B, which imposes an order, results in an integrated
community.

99
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Quiz Night
Years 9+10
Years 11+12 Hard

Eight people usually form three quiz teams:

The teams are organised so that each player knows all of the other players on their team. They also
know some of the players on the other teams. Who knows who can be represented by a graph.
In the graphs below, circles represent people. If there is a line between two people this means that
they do not know each other and so cannot be on the same team. The graphs can be helpful when
assigning teams by colouring in the circles, for example:

Unfortunately, one of the tables is broken tonight, so only two quiz teams can be formed. At
the moment, two teams cannot be formed unless two people are introduced to each other. This
introduction can be shown by removing a line on the graph. But who should be introduced?

Question
Select one line from the graph below that, when removed, allows two teams of four to be formed.

100
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Quiz Night – continued


Years 9+10
Years 11+12 Hard

EXPLANATION
Answer Explanation
Introducing two people means deleting an edge. We need to delete
an edge so that two colours are enough to colour all the vertices
(people) but no two vertices of the same colour are connected by an
edge.

The only possible option is After deleting this edge, we can


the edge marked in orange colour the graph with two colours
below left. as shown below right.

To test that deleting this edge is the only possible choice, we need to consider both the triangle in the
upper right and the pentagon on the bottom.
First consider the triangle in the upper right: Now consider the pentagon on the bottom:

If any edge outside of this


triangle is deleted, we still
need three colours just for the
three vertices of that triangle.
So one of these three edges
needs to be deleted.

If any edge outside of this pentagon is deleted, then it is impossible to colour all five of its vertices with
only two colours. To test this, we can cycle clockwise through the five vertices, alternating colours for
each one. But when we reach the last vertex, it will have the same colour as the first vertex because the
number of vertices in the cycle is odd.
Therefore we need to delete an edge that destroys both the triangle in the upper right and the
pentagon on the bottom at the same time. There is only one edge that is shared by both shapes,
leading us to the only possible answer.

BACKGROUND INFORMATION
Many real-world problems can be reframed as coloured vertices on a graph. An example is a graph
where the vertices are students and an edge between two students shows that they can’t be placed in
the same group. If we colour the vertices with k colours, this can be seen as assigning every student
to one of k groups. Such a colouring is proper if any two vertices directly connected by an edge have
different colours. Often, we just say colouring when we mean a proper colouring. An edge is sometimes
called critical if deleting it makes a proper colouring with fewer colours possible. In the example, this
means that if the corresponding two students are introduced and can then work together, then having
fewer groups becomes possible.
101
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Counting by Nodding
Years 9+10
Years 11+12 Hard

A ticket vending machine uses computer vision (CV) for communication. To purchase n tickets, the
customer standing in front of the vending machine must nod n times and then raise their head once.
The CV system constantly detects the vertical length of the bridge of the nose in the live camera image
and assigns it to the variable nose.

If the value of nose is 1, the head is in its normal


position.

When the customer nods and the head goes down,


the value of nose gets greater than 1, because the
nose appears to be longer.

When the head is raised, the value of nose gets lower


than 1.

The control program is started when a customer stands in front of the vending machine and the head is
in its normal position.

Question
A skeleton of the control program is shown below.
Complete the program by dragging the appropriate condition blocks from the right to the gaps
in the program.

Continued on next page


102
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Counting by Nodding – cont’d


Years 9+10
Years 11+12 Hard

EXPLANATION
Answer

Explanation
The program uses two variables named count and nose. The variable count contains the number of
nods, and nose represents the visible nose bridge (see task) and is automatically updated by the CV
system.
A sequence of three commands is repeated in a loop until the head is raised and therefore nose gets
a value smaller than 0.8. These repeated commands manage the counting: First the system waits until
the head goes down (nose > 1.2) and then waits until it goes up again (nose < 1.1). This is one complete
nod. The value of the variable count is increased by 1.
When the loop is finished (because the person has raised their head such that nose < 0.8), the variable
count contains the number of nods and count tickets are delivered.
The program has to use inequalities, as in real life applications, it will be difficult for the user to get
the exact value of nose = 1 to signify the end of each nod. Similarly, the values used to trigger an action
should be significant enough that it can be considered a deliberate action of the user. For example, if
nose > 1 is used to measure a nod, minuscule head movements can be counted as one nod even though
it is not the intention of the user.

BACKGROUND INFORMATION
Computer vision (CV) makes it possible to communicate with a machine by gestures. An e-book reader
with a clever CV control system enables a person who cannot use thier hands to turn pages by head
movements. For programming languages there exist special program libraries like OpenCV supporting
CV. These libraries contain special commands that make it possible to detect parts of a face like the
eyes or the bridge of the nose in a camera image.
In the task, the program shown is described as a “skeleton of the control program” because it is not a
finished program. It will need further real life testing to check that the variables chosen work in a good
variety of situations, that it produces reliable data in a high percentage of occassions, and that there
are no bugs that lead to the vending machine behaving in unexpected ways.

103
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Log Sort
Years 9+10
Years 11+12 Hard

Tree logs of different sizes are in a river. Beaver Hamid’s task is to sort the logs by size. Hamid moves
along the riverbank, always taking a position between two logs. Hamid compares these two logs by
size and swaps them if necessary.
Hamid knows the logs can be sorted in the following way, no matter how the logs come in initially:
Start at the position on the right of the leftmost log.
Repeat the following until you are on the right of the rightmost log:
• If the log on the left is smaller than the right log: move to the right by one log.
• If the log on the right is smaller than the left log:
– swap these logs;
– unless you are at the starting position: move to the left by one log.
See how Hamid sorts 4 logs in this way. In this example, Hamid has to move 9 times.

The number of times Hamid has to move to sort a group of logs depends on how the logs come
in initially. In the worst case, Hamid would have to move 25 times to sort 6 logs. In the best case
(when the 6 logs are already sorted) Hamid would still have to move 5 times.

Question
Which of the ranges below is the smallest range that will always include how many times Hamid
has to move when sorting all starting arrangements of 60 logs?

0...60 10...90 59...300 59...3,600 59...216,000

Continued on next page


104
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Log Sort – cont’d


Years 9+10
Years 11+12 Hard

EXPLANATION
Answer
59...3,600.

Explanation
[0...60] is wrong. Even in the best case, when the logs are sorted, Hamid has to make 59 moves. More
moves are required if the logs are out of order quickly taking the moves required to beyond 60.
[10...90] and [59..300] are also wrong. To prove it, we need to explore the worst case, when logs are
sorted in the opposite order. In this case, Hamid reaches a log on the kth position and moves it to the
first (leftmost) position, then goes for a log on the (k+1)th position. So for the log on the kth position, we
need to move k-2 times right to reach it, and k-2 times left to put it in the beginning. Thus, we obtain
the sum 2(1+2+...+58) and we need to add 59 moves from the leftmost to the rightmost position at the
end of the algorithm. The sum is exactly 592=3481. This number does not belong to any of these two
ranges.
[59...3600] is correct. To see it, we need to prove that the worst case is really the worst one. When
Hamid reaches the log in the kth position, all previous logs are already sorted properly, so he needs only
to put this new log in the correct position among the previous ones. Then he goes to the log on the
(k+1)th position. So, the smaller is the log on kth position, the greater number of move it requires.
[59...216,000] does include how many times Hamid will have to move when sorting the logs no matter
what their starting positions but this range is not the smallest range that does this.

BACKGROUND INFORMATION
In Computer Science, sorting algorithms are used to put a sequence of objects in a certain order. The
most frequently used orders are numerical order (for numbers) and lexicographical order (for all kinds
of data based on an ordered alphabet). Efficient sorting is important for optimising the efficiency of
other algorithms, such as search algorithms that require input data to be sorted. Also, sorting can be
useful for canonicalising data and for producing human-readable output.
One of the most well-known sorting algorithms is the gnome sort. It is conceptually simple - by working
with one item at a time, the algorithm gets each item to its proper place by a series of swaps. If the
list is initially almost sorted, it works with n swaps for n objects. The gnome sort (sometimes dubbed
“stupid sort”) was originally proposed by the Iranian computer scientist Hamid Sarbazi-Azad (professor
of Computer Science and Engineering at Sharif University of Technology) in the year 2000.
When speaking of an algorithm we always need to consider how ‘fast’ it is, i.e. the number of
operations it requires to sort items in the worst or most disordered case, depending on the number
of elements needed to be sorted. For this algorithm, if we have n objects, we need approximately
n2 operations. This is called a quadratic relationship. The other answers in this task represent other
possible relationships: constant (independent) for [0...60], linear for [10...90], log-linear for [59...300]
and really big (actually increasing by the power of 3) for [59...216,000].
This relationship for a particular algorithm is called the algorithm complexity and is studied in
computational complexity theory.

105
This question comes from Years 3+4
the Philippines Years 5+6
Years 7+8

Unification
Years 9+10
Years 11+12 Hard

In ancient Beavaria, there lived four tribes consisting of several villages. Each tribe had their own flag
as shown in the picture below.
One day, the tribes decided to unify. However, in order to not cause chaos, it was decided that only two
tribes can be unifying at the same time.
The time needed to unify two tribes, in months, is equal to the total number of villages in these two
tribes.
After this, the two tribes become one single tribe, and the unification process is repeated until there is
only one unified tribe remaining.

Question
What is the minimal amount of months needed for the tribes to unify?

23 24 25 26 27

EXPLANATION

Answer
24.

Explanation
The optimal strategy to minimise the total number of months needed to unify all the tribes is to
minimise the number of times each village is included in the unification processes. This can be done by
merging the largest tribes last, as the largest tribes with the greatest number of villages will then only
be added the least amount of times. In order to do this, each unification step should happen between
the two tribes with the fewest villages.

Continued on next page


106
This question comes from Years 3+4
the Philippines Years 5+6
Years 7+8

Unification – continued
Years 9+10
Years 11+12 Hard

This is illustrated in the table below:

1. Green triangles have the least 2. The tribes that now have 3. Lastly, 5 blue triangles and
number of villages, so they the least number of villages circles and 7 orange stripes
will be chosen for unification are orange squares (4) and squares villages unite
first. Since there are two tribes and red stripes (3). After into one large orange shapes
that have 3 villages, we can unification we can call them tribe.
choose to unite either one, for orange stripes and squares.
example, green triangles and
blue circles. After unification
they can be called blue
triangles and circles.

This takes 5 months and results This takes 7 months and This takes 12 months.
in 3 red stripes, 4 orange results in 5 blue triangles and
squares, and 5 blue triangles circles, and 7 orange stripes
and circles villages. and squares.

Therefore, the minimum number of months to unify all four tribes from the land of Beavaria is
5+7+12=24.

BACKGROUND INFORMATION
This challenge is an example of an optimisation problem, a task whose goal is to come up with a
strategy that maximises or minimises a certain quantity, subject to some constraints. Optimisation
problems are ubiquitous in our everyday lives: finding the shortest route to a destination, creating
a schedule that accommodates the most number of non-overlapping activities, and so on. There are
several ways to approach solving an optimisation problem, and these include greedy algorithms.
Greedy algorithms rest on the assumption that making the best choice at each stage (local optimum)
will result in the best final outcome (global optimum). In this problem, this assumption is satisfied:
tribes have to minimise the number of months for each unification in order to minimise the number of
months for the entire unification process.
It must be emphasised, however, that the greedy paradigm is not a universal solution to all types of
optimisation problems. Nevertheless, it usually provides a decent approximation within a reasonable
time.

107
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8

Two Beavers are Working


Years 9+10
Years 11+12 Hard

Two beavers’are building a dam and need to do eight tasks (cut trees, remove branches, float wood,
assemble trunks etc). The beavers decided to record these tasks in shorthand as follows:
A(2), B(3), C(5), D(7), E(10), F(9), G(4), H(6).
Each number in brackets indicates the number of hours to do that task.
Some tasks must be completed before others can be started, as shown by the arrows in the diagram
below. The beavers work in parallel, each taking different tasks.

The beavers try this strategy: Choose the biggest task currently possible.
The beavers end up working on the tasks in this order:

The beavers complete the dam in 32 hours. However, it is possible to complete the dam in a shorter
time with a different strategy.

Question
Create the schedule for the shortest time for the beavers to build the dam below.
Drag the tasks, from the top row, down to each beaver’s task box to create the schedule.
Tasks in grey need other tasks to be completed before they can be assigned.

Beaver 1

Beaver 2

Continued on next page


108
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8

Two Beavers are Working – cont’d


Years 9+10
Years 11+12 Hard

EXPLANATION

A Possible Answer

Explanation
The picture in the tasks shows one possible schedule of the two beavers. We can see that the first
beaver is idle for a relatively long time (8 hours), and the second beaver is idle for 6 hours. It would be
better if they could be working all of the time.
The strategy will use here is to make sure that the two largest tasks E(10) and F(9) are not done by the
same beaver. Above is the picture of one particular schedule that allows all the tasks to be completed
in 23 hours with no idle time for either beaver.

BACKGROUND INFORMATION
For some problem instances, the beavers’ strategy (“choose the biggest remaining”) will yield the
shortest time. For other problem instances (such this one) the strategy of partitioning the largest tasks
seems to work. However, for each of these approaches we can find a problem instance for wl it will
not work so well This is because, unless there are some special restrictions on the problem, the only
guaranteed way of finding the schedule yields the shortest time is to try all possible allowed schedules!
This is impractical in real-world situations; it might take more computer resources 1 find the perfect
schedule than for one beaver to build the whole dam themselves!
In this task, a problem instance was carefully chosen for which the beavers’ strategy (“choose the
biggest remaining”) did not work. So it made it qi difficult; in this case one has to consider the whole
problem instance instead of blindly following a simple strategy. However, for many problem instances,
the beavers’ “greedy” strategy can be good enough, and has the advantage that it is very quick to make
a schedule and get the beavers working straight away.
Carefully finding a problem instance to cause a strategy to perform poorly (as was done in the
preparation of this task) is a real art in computer science, that requires one to deeply understand the
strategy. It is a necessary skill if one wants to determine the worst-case running time of a computer
program, for example, which is part of algorithim analysis and is used in the field of computational
complexity theory.

109
We would like to thank the International Bebras Committee and community for their ongoing assistance, resources
and collaborative efforts. Special thanks to Eljakim Schrijvers, Alieke Stijf and Dave Oostendorp for their support and
technical expertise.

If you would like to contribute a question to the International Bebras community, please contact us via the details below.

Contact us
CSIRO Digital Careers
[email protected]
csiro.au/education/Programs/Digital-Careers

Australia’s National Science Agency


Bebras Australia
Computational
Thinking Challenge
2022 Solutions Guide
Round 2

Primary School
Grades 3–6 bebras.edu.au
Bebras Australia
Computational Thinking
Challenge
Bebras is an international initiative aiming The Bebras international community has now
to promote Computational Thinking skills grown to 60 countries with over 2.9 million
among students. ​ students participating worldwide!

Started in 2004 by Professor Valentina ​ ebras Australia began in 2014 and is now
B
Dagiene from the University of Vilnius, administered through CSIRO Digital Careers.
‘Bebras’ is Lithuanian for beaver. This refers
to their collaborative nature and strong In Australia, the Bebras Challenge takes place
work ethic. in March and August–September each year.
As of 2020, two separate challenges are
The International Bebras Committee meets offered for each round.
annually to assess potential questions and
share resources.​Questions are submitted To find out more and register for the
by member countries and undergo a next challenge, visit bebras.edu.au
vetting process.

Engaging young
423
minds for Australian schools

Australia’s
participated in
Round 2 2022

digital future 25,498


Australian students
participated in
Round 2 2022

CSIRO Digital Careers supports teachers and encourages students’ 2.9 million
understanding of digital technologies and the foundational skills Students participate
they require in an ever-changing workforce. Growing demand worldwide
for digital skills isn’t just limited to the ICT sector. All jobs of the
future will require them, from marketing and multimedia through
to agriculture, finance and health. Digital Careers prepares
students with the knowledge and skills they need to thrive in the
workforce of tomorrow.

csiro.au/digital-careers
2
What is a
Solutions Guide?
Computational Thinking skills underpin the careers of the future. Creating opportunities
for students to engage in activities that utilise their critical and creative thinking along with
problem solving skills is essential to further learning. The Bebras Challenge is an engaging way
for students to learn and practice these skills.

Within this Solutions Guide you will find all of the questions and tasks from Round 2 of the
Bebras Australia Computational Thinking Challenge 2022. On each page above the question
you will find the age group, level of difficulty, country of origin and key Computational
Thinking skills.

After each question you will find the answer, an explanation, the Computational Thinking
skills most commonly used, and the Australian Digital Technologies curriculum key
concepts featured.

3
Contents
What is a Solutions Guide? 3
What is Computational Thinking? 5
Computational Thinking skills alignment 6
Australian Digital Technologies curriculum key concepts 7
Digital Technologies key concepts alignment 8
Years 3+4 9
Exam Results 10
Funny Filter 12
Password 14
Dancing Dress 15
Find Animal 17
Chat Bot 18
Longest Sequence 20
Birds Song 22
Between Dots 24
Fruit Road 26
Napping Together 28
Flower Growth Phases 32
Kangaroo 34
Arranging Shapes 36
Volcanoes 38
Years 5+6 40
Garden Of Eden, Hotel California 41
Cat Pictures 42
Between Dots 44
Grocery Shopping 46
Robot 48
Animal Sorting 49
Presents Program 50
Fifo Restaurant 52
Beaverly’s Food Bags 54
Cupcakes 56
Guess Who? 58
Three Beavers 60
Glass Cabinet 62
Robot Drawing 64
Bank Lock 66

4
What is
Computational
Thinking?
Computational Thinking is a set of skills that underpin learning within the Digital Technologies
classroom. These skills allow students to engage with processes, techniques and digital
systems to create improved solutions to address specific problems, opportunities or needs.
Computational Thinking uses a number of skills, including:

DECOMPOSITION
Breaking down problems into smaller, easier parts.

PATTERN RECOGNITION
Using patterns in information to solve problems.

ABSTRACTION
Finding information that is useful and taking away any information
that is unhelpful.

MODELLING AND SIMULATION


Trying out different solutions or tracing the path of information to
solve problems.

ALGORITHMS
Creating a set of instructions for solving a problem or completing
a task

EVALUATION
Assessing a solution to a problem and using that information again
on new problems.

More Computational
Thinking resources
Visit digitalcareers.csiro.au/CTIA to download the Computational
Thinking in Action worksheets. These can be used as discussion
prompts, extension activities or a framework to build a
class project.
Each resource was designed to develop teamwork; critical and creative thinking;
problem solving; and Computational Thinking skills.

5
Computational Thinking
skills alignment
2022 Round 2 Grade Decomposi- Pattern Modelling &
Abstraction Algorithms Evaluation
Questions level tion Recognition Simulation

Years 3+4

Exam Results Easy

Funny Filter Easy

Password Easy

Dancing Dress Easy

Find Animal B Easy

Chat Bot Medium

Longest Sequence A Medium

Birds Song Medium

Between Dots A Medium

Fruit Road Medium

Napping Together A Hard

Flower Growth Phases Hard

Kangaroo C Hard

Arranging Shapes Hard

Volcanoes Hard

Years 5+6
Garden of Eden, Hotel
Easy
California

Cat Pictures Easy

Between Dots B Easy

Grocery Shopping A Easy

Robot Easy

Animal Sorting Medium

Presents Program Medium

FIFO Restaurant Medium

Beaverley's Food Bags Medium

Cupcakes B Medium

Guess Who? Hard

Three Beavers Hard

Glass Cabinet A Hard

Robot Drawing Hard

Bank Lock Hard

6
Australian
Digital Technologies
curriculum key concepts
Abstraction
Hiding details of an idea, problem or solution that are not relevant, to focus on a manageable
number of aspects.
Data Collection
Numerical, categorical, or structured values collected or calculated to create information, e.g.
the Census.
Data Representation
How data is represented and structured symbolically for storage and communication, by
people and in digital systems.
Data Interpretation
The process of extracting meaning from data. Methods include modelling, statistical analysis,
and visualisation.
Specification
Defining a problem precisely and clearly, identifying the requirements, and breaking it down
into manageable pieces.
Algorithms
The precise sequence of steps and decisions needed to solve a problem. They often involve
iterative (repeated) processes.
Implementation
The automation of an algorithm, typically by writing a computer program (coding) or using
appropriate software.
Digital Systems
A system that processes data in binary, made up of hardware, controlled by software, and
connected to form networks.
Interactions
Human-Human Interactions: How users use digital systems to communicate and collaborate.
Human-Computer Interactions: How users experience and interface with digital systems.
Impact
Analysing and predicting how existing and created systems meet needs, affect people, and
change society and the world.

For more information on the Digital Technologies curriculum, please visit the
Australian Curriculum, Assessment and Reporting Authority (ACARA) website:
australiancurriculum.edu.au/f-10-curriculum/technologies/digital-technologies
7
Digital Technologies
key concepts alignment
Data Data Imple-
2022 Round 2 Grade Abstrac- Data Specifica- Algo- Digital Interac-
Represen- Interpre- menta- Impacts
Questions level tion Collection tion rithms Systems tions
tation tation tion

Years 3+4

Exam Results Easy

Funny Filter Easy

Password Easy

Dancing Dress Easy

Find Animal B Easy

Chat Bot Medium

Longest
Medium
Sequence A

Birds Song Medium

Between Dots A Medium

Fruit Road Medium

Napping
Hard
Together A
Flower Growth
Hard
Phases

Kangaroo C Hard

Arranging
Hard
Shapes

Volcanoes Hard

Years 5+6
Garden of Eden,
Easy
Hotel California

Cat Pictures Easy

Between Dots B Easy

Grocery
Easy
Shopping A

Robot Easy

Animal Sorting Medium

Presents Program Medium

FIFO Restaurant Medium

Beaverley's Food
Medium
Bags

Cupcakes B Medium

Guess Who? Hard

Three Beavers Hard

Glass Cabinet A Hard

Robot Drawing Hard

Bank Lock Hard

8
Bebras Challenge
2022 Round 2

Years 3+4
This question comes from Years 3+4 Easy
Egypt Years 5+6
Years 7+8

Exam Results
Years 9+10
Years 11+12

A teacher at Beaver Primary School sends their students a secret number using pictures of rocks and
trees. The student beavers are given this picture:

Cell 1 Cell 2 Cell 3 Cell 4


Total Score
8 Points 4 Points 2 Points 1 Point

= 9

The students find the number by adding the points of the cells that contain a tree. So they add 8+1=9.

Question
The teacher sends the students a new picture. What is the new secret number?

Cell 1 Cell 2 Cell 3 Cell 4


8 Points 4 Points 2 Points 1 Point

3 6 9 12

EXPLANATION

Answer
Correct answer is 6.

Explanation
The student beavers should add the 2nd and 3rd cells which include the trees.
So the secret number will be 4+2=6.

Continued on next page


10
This question comes from Years 3+4 Easy
Egypt Years 5+6
Years 7+8

Exam Results – continued


Years 9+10
Years 11+12

BACKGROUND INFORMATION
Computers use binary – the digits 0 and 1 – to store data. A binary digit, or bit, is the smallest unit of
data in computing. It is represented by a 0 or a 1. Binary numbers are made up of binary digits (bits), eg
the binary number 1001 is equal to 9.

The circuits in a computer’s processor are made up of billions of transistors. A transistor is a tiny switch
that is activated by the electronic signals it receives. The digits 1 and 0 used in binary reflect the on and
off states of a transistor.

Computer programs are sets of instructions. Each instruction is translated into machine code - simple
binary codes that activate the CPU. Programmers write computer code and this is converted by a
translator into binary instructions that the processor can execute.

All software, music, documents, and any other information that is processed by a computer, is also
stored using binary.

To help you develop a better understanding of the binary system and how it relates to the decimal
system you’re familiar with, here’s how the decimal numbers 1-10 look in binary:

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

10 = 1010

11
This question comes from Years 3+4 Easy
Taiwan Years 5+6
Years 7+8

Funny Filter
Years 9+10
Years 11+12

A photo app has four funny filters; each filter has a different effect shown below:

Remove Whiskers Enlarge Teeth

Apply Blush Reshape Face

After Little Beaver applied the two filters “apply blush” and “reshape face” on a photo, the photo looks
like this:

Question
What might the original photo look like?

Continued on next page


12
This question comes from Years 3+4 Easy
Taiwan Years 5+6
Years 7+8

Funny Filter continued


Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
Since the “enlarge teeth” filter is not used, we can infer that the teeth in the original photo are already
large; therefore, option A and C, both showing relatively small teeth, are not correct. Also, little beaver
has whiskers on the final photo, and no filter that adds whiskers was applied, so the original photo has
to have whiskers. Hence, options A and B are not correct.
We can also find the answer by reversing the effect that the two filters had on the photo, as shown
in the photo below. After removing the “apply blush” filter, we will get the photo in the middle. After
removing the “reshape face” filter from the middle photo, we will get the photo on the right, which is
the original photo.

BACKGROUND INFORMATION

In this task, we are describing the face of beavers using a set of properties, sometimes called attributes.
Each property of a beaver can have different values:
• Teeth can be short or long
• Whiskers can be present or absent
• Head shape can be round or thin
• Cheeks can be bare or have blush

Each funny filter changes the value of one of these properties.


When computers manipulate objects of the real world, they often represent them by such lists of
properties. People in a computer database have properties such as their firstname, lastname, genre,
birth date, birth place, etc. We can then perform searches based on the value of some of these
properties, such as finding all the people called Bob who were born in 2004 in Lithuania.

13
This question comes from Years 3+4 Easy
Egypt Years 5+6
Years 7+8

Password
Years 9+10
Years 11+12

Beavers have a special way to send messages. They use this table to change the letters into numbers,
and then they send the numbers to each other:

A B C D E F G H I J
65 66 67 68 69 70 71 72 73 74

If a beaver would like to send “HI” to their friend, they will send “72.73”.

Question
If a beaver sends “72.73 74.69.70.70” to their friend, what is their friend’s name?

Jace Jeff Jada Jedi

EXPLANATION
Answer
The correct answer is “JEFF”.

Explanation
From the table, the beaver could change every number to its corresponding letter. So, 74.69.70.70 will
be JEFF.
You can also solve this in a quicker way. The encoded message ends with 70.70, so the last two letters
are the same. There is only one answer where the last two letters are the same.

BACKGROUND INFORMATION
Computers can only store numbers internally. This is why when using letters you need what is called an
‘encoding’, a way to translate numbers into letters and vice versa.
ASCII is a table of characters for computers. It is binary code used by electronic equipment to handle
text using the English alphabet, numbers, and other common symbols. ASCII is an abbreviation for
American Standard Code for Information Interchange, and it was developed in the 1960s based on
earlier codes used by telegraph systems.
The code includes definitions for 128 characters: most of these are the printable characters of the
alphabet such as abc, ABC, 123, and ?&!. There are also control characters that cannot be printed but
instead control how text is processed, to start a new line, for example. Most of the control characters
are no longer used for their original purpose.
ASCII uses 8 binary digits (bits) to represent characters: 1000001 (65 in standard base-10 numbers)
represents the upper-case letter A; 1000010 represents B (66); 1000011 represents C (67); and so on in
sequence. Eight bits allow a parity bit to be included in each byte sent over a serial port or modems.
Parity bits are used to detect errors - each character has a number which if changed, alerts the person
who is receiving the message that there was an error in transit. This was more important years ago,
when connections were often unreliable.

14
This question comes from Years 3+4 Easy
Ireland Years 5+6
Years 7+8

Dancing Dress
Years 9+10
Years 11+12

Zuri needs to make a costume for a dancing competition. Zuri goes to a shop that sells craft bags
containing a selection of the items shown in the picture below.

Question
Zuri needs pink fabric, scissors, and gold stars to make the costume.
Which of these craft bags should Zuri buy?

EXPLANATION

Answer

Explanation
Zuri needs to choose a bag that contains pink fabric, scissors, and gold stars.
Craft Bag D (shown above) is correct because it contains pink fabric, gold stars, and scissors.

Continued on next page


15
This question comes from Years 3+4 Easy
Ireland Years 5+6
Years 7+8

Dancing Dress – continued


Years 9+10
Years 11+12

Craft Bag A, , is not correct because it does not contain gold stars.

Craft Bag B, , is not correct because it does not contain scissors.

Craft Bag C, , is not correct because it does not contain pink fabric.

Each bag also contains at least one item that is not required, but this does not affect the answer.

BACKGROUND INFORMATION
This task involves conditional statements. A conditional statement tells a computer program to do
different actions depending on whether a condition is true or false.
In this task we have three conditions that all have to be true in order for Zuri to buy that bag.
Conditions and their evaluation are an important part of computer programming and algorithmic
thinking.
This task also teaches elements of abstraction, in that the students must abstract away from the
individual items, ignoring distractor items, to obtain true/false values whether each bag satisfies
particular properties or not.
This task can also be used as an easy example to introduce pattern recognition to young students, if
the students solve it by constructing their own bag of correct items from the selection in the question,
and then visually comparing bags to find the closest matching bag.

16
This question comes from Years 3+4 Easy
Lithuania Years 5+6
Years 7+8

Find Animal
Years 9+10
Years 11+12

Beaver Bindi can find animal names on the board in class by using arrows. For example, Bindi puts the
arrow below on the letters to spell out the word FOX:

Question
In the picture below, find the name of the animal represented by the arrow next to the table.

MOUSE HORSE BEAVER PANDA BEAR

EXPLANATION
Answer With the given arrow, we can go through the table and find where we
have to put it so that it spells out the name of an animal.. According to
The correct answer
the shape of the arrow (height is 3 cells and width is 2 cells) we can see
is PANDA.
that we have to check all the possibilities on the first line, counting from
the top (3 options) and all the possibilities on the second line, there are
also 3 options. In third line our arrow doesn’t fit, because it’s height is 3
cells. So during this process in the first line, starting with second cell we
found the word PANDA.
This can also be done by process of elimination: there is no M or H in the
picture, and there is no R next to an A, so Mouse, Horse, and Bear can be
ruled out. Looking at the letter B, the word BEAVER can be made using an
arrow, but it would have to go immediately down from B to E, and this is
the wrong shape, so Beaver can be ruled out. Finally, moving to the letter
P, PANDA can be spelled and the arrow is the right shape.

BACKGROUND INFORMATION
The task is about rows and columns of letters, a type of two-dimensional array, and searching
continuous sequence of positions according to a pattern. Using programming patterns is very common
when creating various programs.
17
This question comes from Years 3+4 Medium
Taiwan Years 5+6
Years 7+8

Chat Bot
Years 9+10
Years 11+12

Dr. Beaver has made an app called “Botty”, a virtual assistant on mobile phones. Every time you ask a
question, Botty opens an app based on the “keyword” your question starts with:

When the question


then Botty opens a...
starts with...

Where
Map app

What
Search Engine App

How
Video App

If the question does not start with the keywords listed above, Botty will not respond.
For example, when you ask “How to learn to code”, Botty opens a video app; when you ask
“Will it rain tomorrow”, Botty will not respond.

Question
Which of these statements are correct? You are able to choose more than one.

When asked “When is Easter”, Botty activates a search engine app

When asked “What is a decimal”, Botty activates a search engine app

When asked “When is Easter”, Botty activates a search engine app

When asked “How to get to the train station”, Botty activates a map app

Continued on next page


18
This question comes from Years 3+4 Medium
Taiwan Years 5+6
Years 7+8

Chat Bot – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
B. When asked “What is a decimal”, Botty activates a search engine app.
C. When asked “Where is my eraser”, Botty activates a map app.

Explanation
A. When asked “When is Easter”, Botty activates a search engine app.
B. When asked “What is a decimal”, Botty activates a search engine app.
C. When asked “Where is my eraser”, Botty activates a map app.
D. When asked “How to get to the train station”, Botty activates a map app.

• Although option A seems logical for a human (activating a search engine app based on the keyword
“When”), Botty should not respond, since the keyword “When” is not in the keyword list.
• For option B, Botty activates a search engine app based on the keyword “what”. This option fits not
only the Dr. Beaver rules, but also human logic.
• For option C, Botty activates a map app based on the keyword “where”. Although Botty’s response
seems illogical for a human, Botty indeed follows the rules.
• In option D, Botty should activate a video app based on the keyword “how”. Although activating a
map app fits human reaction, it does not fit the rules set by Dr. Beaver.
So the correct descriptions are B and C.

BACKGROUND INFORMATION
This task introduces basic concepts of virtual assistants. A chatbot is one example of virtual assistants.
Some chatbots are equipped with natural language processing systems. Natural language processing
explores how to program computers to process and analyze natural language data.
Basic natural language process system only retrieve some keywords and find an appropriate response
from the corpus (a collection of language materials), where complex natural language process system
can deal with large amount of langauge data. Since apps behaviour depends only on programmer
work, it is important to provide an appropriate logic that would be similar to human one while
programming.

19
This question comes from Years 3+4 Medium
Ukraine Years 5+6
Years 7+8

Longest Sequence
Years 9+10
Years 11+12

Your friend Connie made you a chain using 16 beads. Connie used two types of beads:

You notice the longest sequence of the same colour beads in a row is 4 - the blue beads on the left, and
the black beads on the right.
Connie allows you to change any two beads in the chain, to the colour of the other bead.

Question
After changing two beads, what is the longest possible sequence of the same colour beads in a row
inside the chain?

7 8 9 10

EXPLANATION

Answer
The correct answer is 9.

Explanation
To show this, we need to prove two things:
1. that an unbroken chain of length 9 is possible, and
2. that an unbroken chain of length greater than 9 is not possible.

The first part is easy to prove. Here is how an unbroken chain of 9 stars can be made:

To prove that an unbroken chain of length greater than 9 is not possible, consider any chain of length
10. Since we are only allowed to change two shapes, any chain of length 10 in the original sequence
must already have eight identical shapes in it.
There are seven chains of length 10 in the original sequence, a few of which are shown below. In no
chain can eight identical shapes be found. Convince yourself of this for the remaining unshown three
chains.

Continued on next page


20
This question comes from Years 3+4 Medium
Ukraine Years 5+6
Years 7+8

Longest Sequence – continued


Years 9+10
Years 11+12

Since it is not possible to have an unbroken chain of length 10, it is certainly not possible to have an
unbroken chain of length greater than 10.
Thus, we have shown that the length of the longest unbroken chain of identical shapes possible is 9.

BACKGROUND INFORMATION
This task is related to finding the longest substring that matches some given criteria.
There are many instances in informatics where finding the longest substring is useful, in particular,
finding the longest common substring given two strings.
Finding the longest common substring can help detect plagiarism, and help compress data by data
reduplication (removing redundant copies of data).
Some techniques that can be used to find the longest sequences include the two pointer method, and
the sliding window.

21
This question comes from Years 3+4 Medium
Pakistan Years 5+6
Years 7+8

Birds Song
Years 9+10
Years 11+12

A bear living in a cave in Beaverland predicts weather each morning by listening to the sounds of three

birds (bird Ollie, bird Sandy and bird Felix) living nearby.

If the sounds follow all of the 3 rules below, the bear believes that the weather will be good and will
come out of the cave. Otherwise the bear will stay in the cave.

Conditions for good weather:


1. All three birds sing at least one sound.

2. Ollie sings exactly one sound.

3. Sandy sings at least two sounds in a row.

Question
Which of the following sequences of bird sounds will make the bear come out of the cave?

S-F-O-F-F-S-F S-S-S-O-S-S-S F-S-O-S-S-F-F S-F-O-S-S-O-F

Continued on next page


22
This question comes from Years 3+4 Medium
Pakistan Years 5+6
Years 7+8

Birds Song – continued


Years 9+10
Years 11+12

EXPLANATION

Answer

The correct answer is F-S-O-S-S-F-F, because all three birds sing, (S) sings twice in a row and

(O) only once.

Explanation
The other answers are not correct:

- In sequence S-F-O-F-F-S-F (S) does not sing twice in a row.

- In sequence S-S-S-O-S-S-S (F) does not sing at all.

- In sequence S-F-O-S-S-O-F (O) sings twice.

BACKGROUND INFORMATION

This question is related to the concepts of pattern recognition and classification, which are common
tasks in many computer science applications.
Pattern recognition refers in general to the task of automatic discovery of regularities (= “pattern”)
in data in order to for example classify the data into some category. In this task the three conditions
for good weather specified a pattern, and the data consisted of a sequence of bird sounds. The goal
was then to classify the data to one of two categories — “good weather” or “bad weather” — based
on whether we could recognise the good weather pattern from the data. This type of classification
problem that has only two categories is known as binary classification.

23
This question comes from Years 3+4 Medium
Iceland Years 5+6
Years 7+8

Between Dots
Years 9+10
Years 11+12

Emma plays with a “DoodleBot” that draws lines between dots.


She pushes arrow buttons to send the robot to the next dot.
The robot starts on the dot with the circle around it.

This arrow sequence tells the robot to draw:

Question
Emma pushed the buttons in this sequence, and started on the dot with an orange circle around it:

What did the robot draw in this grid?

Continued on next page


24
This question comes from Years 3+4 Medium
Iceland Years 5+6
Years 7+8

Between Dots – continued


Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
The robot starts on the dot with the surrounding circle and the arrows shows how it follows
the commands:

BACKGROUND INFORMATION
Computer programs are a series of commands that tell a device what to do. All computer programs are
run (activated) by pressing a button or typing a command.
One of the basic things in informatics and robotics for students to learn is that a robot or a computer
follows commands in a sequence / specific order and executes actions in that order. Students will learn
that a computer or robot will only respond to commands it has been given. The commands must be
precise. Students use algorithmic thinking to follow the sequence of button commands in the question.
They will also look at the data representations given in the multiple choice answers to select the
correct image representation. Using recipes as a metaphor might help students to understand better.
The steps of cooking are like instructions, and only correct instructions can make delicious meals.
It is important to understand the instructions and execute them step by step to see what is happening.
These steps will be useful for debugging. Debugging is the process of working through a program
sequence to see where errors might have occurred. It is useful to have students ‘think-aloud’ (talk
through actions as they are making them), especially when debugging. Discussing where they might
have gone wrong is a useful process for students to learn that we all make mistakes and need to follow
steps to fix them. Even the best computer programmers make mistakes. Debugging is a natural part of
the process of learning.

25
This question comes from Years 3+4 Medium
Uruguay Years 5+6
Years 7+8

Fruit Road
Years 9+10
Years 11+12

Beaver Nerida walks from her home to the river and collects all the fruits on her path. At the end
of her walk, she sits down on the river bank and eats each of the three fruits she has picked.

She wants to eat a pineapple but NOT an orange .

Question
How many different paths could she use?

26
This question comes from Years 3+4 Medium
Uruguay Years 5+6
Years 7+8

Fruit Road – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
The correct answer is 3.

Explanation
There are exactly three paths that contain a pineapple but not an orange, as shown on the picture.

BACKGROUND INFORMATION
On the paths, when Nerida reaches a fruit, she picks it then decides where to go moving forward. She
can choose only one direction at a time from a fruit towards the river.
In the figure, the paths are drawn as edges and the fruits as vertices. All paths to the river are one-way.
In informatics, such figures are called graphs. These types of graphs (without a cycling walk) are called
trees.
This graph has a root - the residence of the beaver - from where the paths begin. The graph consists of
edges - the paths, that connect vertices - the fruits. The ends of the paths are at the river, these vertices
are called leaves of the graph.
At each fruit - at each vertex - Nerida has to decide where to go forward, which path she chooses.
In informatics, we call such figures decision trees.
We can count the paths from Nerida’s residence to the river - the edges from the root to the leaves on a
graph. There are special paths that meet certain conditions, for example the path where a pineapple is
present and a path where an orange isn’t on them.

27
This question comes from Years 3+4 Hard
Taiwan Years 5+6
Years 7+8

Napping Together
Years 9+10
Years 11+12

When two otters in Otter Kingdom meet each other, they will wrap seaweed around themselves so that
they can stay together during nap time. However, to avoid knots, if two otters are already connected
through a seaweed chain, they won’t wrap another seaweed.

For instance, if otters meet each other in the following order: A - B, A - C, B - C:


1. Otter B meets Otter A. They wrap seaweed around themselves.

2. Otter C meets Otter A. They wrap seaweed around themselves.

Continued on next page


28
This question comes from Years 3+4 Hard
Taiwan Years 5+6
Years 7+8

Napping Together – continued


Years 9+10
Years 11+12

3. Otter C meets Otter B. Since they are already connected through Otter A, they won’t wrap seaweed
around themselves.

Question
Otters meet each other in the following order:
A - B, A - C, B - C, D - E, A - E, D - F, A - F

How many seaweeds are wrapped around otter A?

EXPLANATION

Answer
3.

Continued on next page


29
This question comes from Years 3+4 Hard
Taiwan Years 5+6
Years 7+8

Napping Together – continued


Years 9+10
Years 11+12

Explanation
A meets B. They wrap seaweed around themselves.
One seaweed is wrapped around otter A at this point.

A meets C. They wrap seaweed around themselves.


Two seaweeds is wrapped around otter A at this point.

B meets C. Since they are already conneted, they won’t wrap any seaweed around themselves.
D meets E. They wrap seaweed around themselves.

Continued on next page


30
This question comes from Years 3+4 Hard
Taiwan Years 5+6
Years 7+8

Napping Together – continued


Years 9+10
Years 11+12

A meets E. They wrap seaweed around themselves.


Three seaweeds is wrapped around otter A at this point.

D meets F. They wrap seaweed around themselves. A meets F. Since they are already connected, they
won’t wrap any seaweed around themselves.

Thus, only three seaweeds are wrapped around otter A.

BACKGROUND INFORMATION
“Disjoint-set” or “union-find” is a data structure that stores a collection of disjoint (non-overlapping)
sets. It provides operations such as adding new sets and merging sets. In this task, we merge two sets
by wrapping a seaweed around two otters.
A disjoint-set is an important data structure when implementing Kruskal’s algorithm to find a minimum
spanning tree in a graph. A disjoint-set is used for preventing cycles in the selected edges, which is
exactly how we avoid knots in this task.
31
This question comes from Years 3+4 Hard
Saudi Arabia Years 5+6
Years 7+8

Flower Growth Phases


Years 9+10
Years 11+12

Beaver Bo took five pictures of a flower growing for a science project, but they came out in the wrong
order. He wants to rearrange his pictures in the correct order from left to right to display them in his
class. He can only swap (any) two pictures at a time.

Question
What is the minimum number of swaps needed to put the pictures in the correct order?

3 4 5 6

EXPLANATION
Answer
The correct answer is 3 swaps.

32
This question comes from Years 3+4 Hard
Saudi Arabia Years 5+6
Years 7+8

Flower Growth Phases – cont’d


Years 9+10
Years 11+12

Explanation
To reach the correct order we need to swap the pictures as shown in the following table:

Swaps Results
1. Swaps pictures
at positions 3 and 5

2. Swaps pictures
at positions 2 and 4

3. Swaps pictures
at positions 1 and 2

BACKGROUND INFORMATION
This question touches on a concept called a Swap Function. In computer science, a swapping process
refers to mutually exchanging the values of two variables.
Usually, this process is executed in memory. This operation can be performed for different data types,
such as strings and aggregated data types.
In many cases, programmers are required to swap values of two variables while creating a program. So,
this is a very common function used in all programming languages.
In computer programming, the exclusive “OR” swap (sometimes shortened to XOR swap)
is an algorithm that uses the exclusive or bitwise operation to swap the values of two
variables without using the temporary variable which is normally required.

33
This question comes from Years 3+4 Hard
Uzbekistan Years 5+6
Years 7+8

Kangaroo
Years 9+10
Years 11+12

Kangaroo Mae (M) needs to reach kangaroo Claire (C) by jumping on islands in a swamp.

The swamp is represented as a grid as shown below.


Mae can only perform two kinds of jumps: short and long.
• Short jumps are to move from one island to any of the four neighbouring islands.
• Long jumps are to jump straight over any of the four neighbouring spaces to an island two spaces
away. Long jumps are more tiring and dangerous, so she cannot make two long jumps in a row.

Short Jump Long Jump

Mae cannot make any other jumps (diagonal moves, jumps over two or more spaces, etc).
However, Mae is able to revisit an island where she has already been before:

34
This question comes from Years 3+4 Hard
Uzbekistan Years 5+6
Years 7+8

Kangaroo – continued
Years 9+10
Years 11+12

Question
Make a path for Mae to get to Claire by clicking on the islands that Mae jumps on.

EXPLANATION
Answer
The image below shows the solution to the problem:

Explanation
The cells with dark blue background are the
cells that could be visited. A correct path is
in red.
When you visit a dead end road, one way
to find the solution is to leave the boxes
already visited marked and to go back to the
previous intersection.

BACKGROUND INFORMATION
The problem uses a version of Breadth First Search - a modified Lee algorithm. Lee’s algorithm simulates
the motion of a wave crest that floods adjacent cells. In this problem, cells will also be adjacent, if they
are reached by two jumps of a kangaroo: first a long one, then a short one.

35
This question comes from Years 3+4 Hard
India Years 5+6
Years 7+8

Arranging Shapes
Years 9+10
Years 11+12

Rinki the beaver is playing with her shapes board game. The board is divided into multiple squares.
She starts the game off with the shapes placed in each square like this:

As she plays, she swaps various pairs of shapes, meaning that she makes the two shapes exchange
their position.
She makes four swaps, in the following order:

Question
What will the position of be after the last swap?

36
This question comes from Years 3+4 Hard
India Years 5+6
Years 7+8

Arranging Shapes – continued


Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
In this task, only five of the shapes are swapped around, so we can ignore the shapes not involved.

The initial positions of the


five shapes used are
shown below:
After the first swap:

After the second swap:

After the third swap:

After the fourth swap:

BACKGROUND INFORMATION
This task focuses on the swapping function. In computer programming, a variable is a memory
allocation that can hold information. Swapping involves exchanging the values of any two variables of
a compatible datatype.
For example, if A is a variable that holds the value “Name” and B is another variable that holds “Date of
birth”. After the swap function is performed, variable A will hold “Date of birth” and B will hold “Name”.
These steps of the swap function can be used for sorting a given set of data in any order. For example,
ascending or descending order.

37
This question comes from Years 3+4 Hard
Romania Years 5+6
Years 7+8

Volcanoes
Years 9+10
Years 11+12

Dino wants to get from point A to point B.

For safety reasons, if a volcano erupts, all the roads connected to the volcano are closed up to the next
intersection, like in the picture below:

Dino is very worried they won’t be able to get to point B if more than one volcano erupts.

Question
Which two volcanoes must erupt at the same time so that Dino can NOT reach their destination?

Volcanoes 1 and 2 Volcanoes 3 and 2 Volcanoes 2 and 4 Volcanoes 1 and 4

38
This question comes from Years 3+4 Hard
Romania Years 5+6
Years 7+8

Volcanoes – continued
Years 9+10
Years 11+12

EXPLANATION
Answer
Volcanoes 2 and 4.

Explanation
There are several paths from A to B. However, each path must go through either volcano 2 or 4. If
volcanoes 2 and 4 erupt, Dino will no longer be able to reach point B. You can see this in the image.

For the other options, there still exists a path from A to B.

BACKGROUND INFORMATION
A graph is a set of nodes (vertices) connected to each other by edges (in our case the nodes are
volcanoes or intersections), and the edges are represented by the roads between 2 nodes.
In this problem, a subgraph is obtained from the initial graph by removing the selected vertices
(erupted volcanoes) and edges that have the nodes at the end. We want to find a subgraph in which
the points A and B cannot be connected by a succession of vertices connected by edges after removing
two vertices. A vertex is named an articulation point (or cut vertex) if removing it and its connected
edges disconnects a connected graph. In this problem, all the vertices of volcanoes are not articulation
points. Therefore, removing a single vertex of volcano will not disconnect the graph. The above
concept can be used to check the fault tolerance of a network system.

39
Bebras Challenge
2022 Round 2

Years 5+6
This question comes from Years 3+4
the Netherlands Years 5+6 Easy
Years 7+8

Garden Of Eden, Hotel California


Years 9+10
Years 11+12

In Beaver County there are 10 towns connected by roads. The local council decides to make some of the
roads one-way roads, which means beavers can only move along them in one direction.

This first design is below, where means a one-way road with the arrow pointing in the
direction beavers have to travel.
• If a town can not be entered due to the one-way roads, it is called a “Garden of Eden”.
• If a town can not be left due to the one-way roads, it is called a “Hotel California”.
The council wants to avoid both of these situations.

Question
Which of the towns are a “Garden of Eden” or a “Hotel California”?

EXPLANATION
Answer
B is a “Garden of Eden”.
No town is a Hotel California.

Explanation
In B there are only outward directed one-way roads. All other towns with at least one outward directed
one-way road has another road that leads into it (G,H,J).
For a “Hotel California” to exist, the town can only have inward directed one-way roads connected to it.
For all towns with at least one inward directed one-way road, there is another road that can lead away
from the town - From A, F and E we can go to D, from H we can go to K, and from K we can go to J.

BACKGROUND INFORMATION
Analysing a network like a map is an important task in many applications. This type of graph using dots
and lines and one-way roads is called a directed graph. Using graphs can help to analyse the possible
routes and to identify possible errors in design, like a “Garden of Eden” or a “Hotel California”.
The flow through a computer program can also be shown using a network or a graph. A software
designer can look at the flow of the program using a graph to discover whether some statements can
be reached and if they get a proper follow up.
41
This question comes from Years 3+4
Switzerland Years 5+6 Easy
Years 7+8

Cat Pictures
Years 9+10
Years 11+12

Aika loves taking pictures of her cat and posting them on Bebragram.
The computer orders pictures by name, from 0 to 9, and from A to Z.
Aika wants her pictures ordered from oldest to newest, so she always adds the date to the name.
Aika tries out some filename patterns for a picture from August 19, 2021.

Question
Which filename pattern should Aika use?

cat_august_19_2021 cat_19_august_2021 cat_19_8_2021 cat_19_08_2021

cat_2021_august_19 cat_2021_19_8 cat_2021_08_19 cat_2021_8_19

EXPLANATION
Answer
Aika should use the pattern G: cat_2021_08_19.

Explanation
Pattern A through D, cat_august_19_2021, cat_19_august_2021, cat_19_8_2021, and cat_19_08_2021 are
incorrect.
If we have pictures from different years, then we want all pictures from one year to be next to each
other, even if they have different months and days. Therefore, the year should come before the month
and day in the name. The reason for this is that then the names of pictures from the same year all have
the same beginning part in their name, and so will be ordered close together by the computer.
If either the month or day appear before the year, which happens in the patterns listed above, then two
photos taken on the same day and month, but one year apart, will be ordered together. For example,
a photo from August 19, 2022, will be ordered next to one from August 19, 2021, which is not what
Aika wants.

42
This question comes from Years 3+4
Switzerland Years 5+6 Easy
Years 7+8

Cat Pictures – continued


Years 9+10
Years 11+12

Pattern F, cat_2021_19_8, is also incorrect.


For the same reason, the month should appear before the day: if both the year and month are
identical, then the pictures should be grouped close together. For this reason, this pattern will not
work, as it would sort a picture from September 19, 2021, in between two pictures from August 18, 2021,
and August 20, 2021.
Pattern E, cat_2021_august_19, is also incorrect.
We can also see that the month needs to be written as a number. If it is written as a word, as in this
pattern, then the photos from August and April would be close together in the ordering. However,
photos from March and May should be close to April, not August.
Pattern H, cat_2021_8_19, is incorrect.
The main difference between patterns G and H is that the month is written as “08” in pattern G and as
“8” in pattern H. For the months from January through September, both patterns work fine. But for the
months October, November, and December, which have two digits when written as a number, this will
cause a problem with pattern H.
Take for example photos from August 19, 2021, and December 19, 2021. In pattern H, these dates will
be written as 2021_8_19 and 2021_12_19. We want 2021_8_19 to be ordered before 2021_12_19, but the
computer will order 2021_12_19 first because alphabetically the ‘1’ from ‘12’ comes before ‘8’.

BACKGROUND INFORMATION
In computer science, ordering data is called sorting. Sorting data is a very common task; computer
science tells us how sorting can be done efficiently.
Sorting is so important because it is used as part of many other algorithms. So the efficiency of our
sorting algorithms affects the efficiency of other algorithms. The choice of sorting algorithm depends
on the data set that we wish to sort. The simplest sorting algorithms that you may know about already
are: bubble sort, insertion sort, and selection sort.
Representation of dates in files and computer memory is an important issue in computer technology.
Before the year 2000 many computer systems used only two digits for the year, e.g. 81 to mean 1981.
Now, most dates in computer systems follow the pattern YYYYMMDD. Here, YYYY stands for four digits
for the year, MM is for the two digits for the month, and DD is for two digits for the day. This pattern
will work fine for computer systems until about 8,000 years from now, in the year, 10000.

43
This question comes from Years 3+4
Iceland Years 5+6 Easy
Years 7+8

Between Dots
Years 9+10
Years 11+12

Emma is playing with a robot that draws lines between dots. She pushes arrow buttons to send
the robot to the next dot.
The robot starts on the dot with the surrounding circle.

This arrow sequence tells the robot to draw:

Question
Which of the following commands can draw the shape shown left?

Continued on next page


44
This question comes from Years 3+4
Iceland Years 5+6 Easy
Years 7+8

Between Dots – continued


Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
The buttons can be pushed in two types of sequences to draw this image:

or

BACKGROUND INFORMATION
Computer programs are a series of commands that tell a device what to do. All computer programs are
run (activated) by pressing a button or typing a command.
One of the basic things in informatics and robotics for students to learn is that a robot or a computer
follows commands in a sequence / specific order and executes actions in that order. Students will learn
that a computer or robot will only respond to commands it has been given. The commands must be
precise.
Students use algorithmic thinking to follow the sequence of button commands in the question. They
will also look at the data representations through the drawing of the correct image representation
by pressing buttons in the correct sequence. Using recipes as a metaphor might help students to
understand this concept better. The steps of cooking are like instructions, and only correct instructions
can make delicious meals.
It is important to understand the instructions and execute them step by step to see what is happening.
These steps will be useful for debugging. Debugging is the process of working through a program
sequence to see where errors might have occurred. In this case, students can press the reset button to
try their solution if the first one doesn’t work. It is useful to have students ‘think-aloud’ (talk through
actions as they are making them), especially when debugging. Discussing where they might have gone
wrong is a useful process for students to learn that we all make mistakes and need to follow steps to fix
them. Even the best computer programmers make mistakes. Debugging is a natural part of the process
of learning.

45
This question comes from Years 3+4
Taiwan Years 5+6 Easy
Years 7+8

Grocery Shopping
Years 9+10
Years 11+12

Below is a map of the village where the Beaver family lives. Ordered clockwise/to the left of the
Beavers’ home is the bookstore, meat shop, supermarket, seafood shop, and finally the flowershop.

To go from one building to another, the Beavers walk along either a muddy path or
a rocky path . Walking between two buildings takes Little Beaver 5 minutes by muddy path and
8 minutes by rocky path .
For example, it takes Little Beaver 5 minutes to go home from the flower shop or the bookstore, and
8 minutes to go home from the seafood shop or the meat shop.

Mother Beaver asks Little Beaver to help with the grocery shopping. The shopping list is shown above.
Little Beaver needs to start the shopping trip from their home, finish all the shopping and then come
back home - however, Little Beaver can do the shopping in any order.

Question
What is the minimum walking time Little Beaver needs?

18 minutes 20 minutes 28 minutes 30 minutes

EXPLANATION

Answer
The correct answer is 28 minutes.

Continued on next page


46
This question comes from Years 3+4
Taiwan Years 5+6 Easy
Years 7+8

Grocery Shopping – continued


Years 9+10
Years 11+12

Explanation
Let’s assume you are Little Beaver. Since you have to start from your home, finish buying things from
4 shops, and come back home, you will have to walk through at least 5 segments of paths. Each path
takes at least 5 minutes, so you need at least 5 * 5= 25 minutes to complete the task. Therefore, options
18 minutes and 20 minutes are wrong.

To get to the meat shop or the seafood shop, it will take you 10 minutes (through the bookstore or the
flower shop, respectively), or 8 minutes (directly). Since you also need to go to the supermarket and the
flower shop, the most efficient way to go to the seafood shop is not directly through the rocky path.
Similarly, since you don’t have to go to the bookstore, it is more efficient to take the rocky path
between the meat shop and your home. Therefore, the meat shop should be your first or last stop.
It takes 5 * 4 = 20 minutes to walk from shop to shop, so the total walking time is at least 8 + 20 = 28
minutes. The selected path is shown above.

BACKGROUND INFORMATION
In this task, we can find the shortest route by drawing it out. However, in real life, when there are
thousands of paths to choose from instead of 15, we will need help from technology, such as GPS and
routing software, to find the shortest path.
In computer science, graphs are a common way to show relationships between data. Graphs can be
used to represent links between objects, it is a method of representing the connections between things
with vertices and edges. Graphs also make it easier to describe the relationships (often represented by
edges) amongst key points (often represented by vertices) of complex concepts.
In graph theory, the shortest path problem aims to find the shortest path (edge) between two points
(vertices). These paths may have different priorities (weights). To account for these priorities (weights),
we have to multiply each distance by its weight. This is called a weighted distance. In this case, the
solution to the shortest path problem is finding the smallest weighted distance.

47
This question comes from Years 3+4
India Years 5+6 Easy
Years 7+8

Robot
Years 9+10
Years 11+12

Ram is a tennis player. They programmed a robot to pick up tennis balls that end up scattered on the
court, and put them into a basket at the back of the court.
The flowchart of this program is shown below, starting with the green ‘play’ symbol:

Here are the programmed commands in clockwise motion, following the arrows:
1. Wait for a ball on the floor
2. Go to the ball
3. Pick up the ball
4. Go to the basket
5. Put the ball into the basket
Ram throws a ball on the court to test the robot. Unfortunately, after some actions, the robot stays in
the middle of the court where the ball was, and is holding the ball but not moving.

Question
What is the first step that the robot failed to perform?

“Wait for a ball on the floor!” “Go to the ball!” “Pick up the ball!”

“Go to the basket!” “Put the ball into the basket!”

EXPLANATION
Answer
The robot failed to perform the next step: go to the basket.

Explanation
Lets understand the observations made by Ram. Ram observed that the robot is in the middle of the
court, holding the ball.
This means the robot succeeded in waiting for a ball on the floor, then managed to go to the ball, and
finally managed to pick up the ball. However, the robot stays in the middle of the court where the ball
was, and is still holding the ball, so it failed to perform the next step: go to the basket.

BACKGROUND INFORMATION
This task focuses on logical reasoning and debugging. Debugging is a process of fixing a bug or
removing errors in the program. This act of debugging begins after the program fails to execute
properly. As a developer/programmer, one must be able to identify the part of code that needs
improvement.
Once the incorrect patch of the program is identified it becomes convenient for the programmer to
change the code and apply the patch to the main program. The main program is then validated.
48
This question comes from Years 3+4
the United States Years 5+6 Medium
Years 7+8

Animal Sorting
Years 9+10
Years 11+12

The animal species in Beavertown can be distinguished by their features.


To identify an animal, citizens of Beavertown use a decision tree. When the answer to a question is
“YES” they go down and when the answer to a question is “NO” they go right.
The decision tree below can tell the difference between eight animal species. Some animals can be
identified with just one question, others need seven questions before they are identified.

Question
Click on all the animals that need more than three questions before the citizens of Beavertown can
identify them with this decision tree.

EXPLANATION
Answer
Animal species 3 (dog), 4 (rabbit), 5 (beaver), 6 (bear) and 7 (pig) need more than 3 questions before
we can identify them.

Explanation
Animal species 1 (crocodile), 2 (bird) and 8 (cat) will be identified with the first three questions.

BACKGROUND INFORMATION
In informatics decision trees are a useful way to display information. It uses a tree-like model (with roots
and branches) to display decisions and consequences. Decision trees are also often used in Artificial
Intelligence. An AI-machine can use a decision tree to filter through facts and past incidences to predict
a likely future outcome, event or action or for identification, example diagnostic in medicine.
In this task we used a decision tree to display information about a set of animals. The decisions are the
questions about the animals, and the final consequence is the animal that you end up with.
A decision tree can be compared with what computer programmers would call an ‘IF-THEN-ELSE’-
statement. This instruction is often nested and may contain logical connectors. Sometimes people use
flow charts for these statements as well.

49
This question comes from Years 3+4
Ireland Years 5+6 Medium
Years 7+8

Presents Program
Years 9+10
Years 11+12

A group of friends give presents to one another according to these rules:


• Rule 1: No friend can give a present to themselves.
• Rule 2: Each friend must give one present.
• Rule 3: Each friend must receive one present.
For any size group of friends, who gives a present to whom is decided according to these rules.
For example, a group of two friends would look like:

Question
For a group of four friends, you are given the following options.
One of the following figures does not follow the rules! Which one?

EXPLANATION
Answer
The correct answer is the one started from Chiki Chi giving a present to Cathy Cat.

Explanation
Chiki Chi giving a present to Cathy Cat has mistakes because it says that Beary Bear should give two
presents and that Don Dog should receive two presents. According to the first rule each friend is
only supposed to give one present and according to the second rule each friend is only suppposed to
receive one present.
Other answers conform to all three rules: each friend gives and receives one present and no friend
gives a present to themselves.

Continued on next page


50
This question comes from Years 3+4
Ireland Years 5+6 Medium
Years 7+8

Presents Program – continued


Years 9+10
Years 11+12

In the first one, Beary Bear exchanges present with Chiki Chi and Cathy Cat exchanges presents with
Don Dog.
In the second one, Cathy Cat should give a present to Beary Bear; Beary Bear should give a present to
Chiki Chi; Chiki Chi should give a present to Don Dog; Don Dog should give a present to Cathy Cat.
In the last one, Beary Bear should give a present to Don Dog; Don Dog should give a present to Cathy
Cat; Cathy Cat should give a present to Chiki Chi; and Chiki Chi should give a present to Beary Bear.

BACKGROUND INFORMATION
This task can be regarded as a pattern recognition task. Each answer is a correct representation of a
pattern with specific properties: each blue arrow joins two different friends (Rule #1) and each friend
appears exactly once on each side of a blue arrow (Rule #2 and Rule #3).
If each answer is considered as an output of a program for distributing presents in a group of friends
that must comply with all three rules, then the process of tracing and examining each output is part
of the program (software) testing. The conformity of each answer is checked against the rules. The
objective of software testing is to find errors.
Being sure that a computer program will run correctly is a big problem in computer science. Computer
scientists have devised techniques to prove that some computer programs are correct, but computer
scientists also know that no one set of techniques will work for all programs (this comes from
computer theory, where we know that any nontrivial property of a computer program is undecidable).
So, we often have to run programs many times to increase our confidence that they are correct. This is
called software testing.
Software testing is a big part of computer science. There are many specialised automated techniques
that can test all parts of a computer program, and all professional software is automatically re-tested
each time the developers change it. However, it still requires considerable expertise to design tests.
Two things you have to do to solve this task are in common with software testing: you have to analyse
what the goals of the program are and look for specific features in the program’s output to tell if it is
working correctly or not. While software testing can be very useful, unfortunately it doesn’t find all the
errors in programs all the time. Computer programs are just very difficult to get right, especially as they
get larger and larger.

51
This question comes from Years 3+4
Saudi Arabia Years 5+6 Medium
Years 7+8

Fifo Restaurant
Years 9+10
Years 11+12

A busy beaver restaurant uses a waiting list - when a customer arrives they write their name on the list.
Normally, the chef takes the order of the customer who arrived first on the waiting list. However, the
oldest beaver is given priority even if they arrive after a younger beaver.
Four beavers want to order food. Ben is the oldest beaver, followed by Alex, then Bob, and finally Dan is
the youngest.
Bob and Alex arrive first and write their names first on the waiting list. Then Ben arrives. The last
beaver to arrive is Dan. The chef then comes out to serve the four beavers.

Question
Based on the rules followed at the restaurant, in what order will the host serve the customers?

Bob, Alex, Ben, Dan Dan, Bob, Alex, Ben Alex, Ben, Bob, Dan Ben, Alex, Bob, Dan

EXPLANATION
Answer
The correct answer is Ben, Alex, Bob, Dan.

Explanation
Beavers in the waiting list are ordered by age when they arrive in the waiting list. In fact, as long as the
four beavers are served together, it doesn’t matter which order that they arrive.
State-1: When Bob and Alex are in the waiting list, Alex has the highest priority because he is older
than Bob.

Alex Bob

1st priority 2nd priority


Continued on next page
52
This question comes from Years 3+4
Saudi Arabia Years 5+6 Medium
Years 7+8

Fifo Restaurant – continued


Years 9+10
Years 11+12

State-2: When Ben arrives, Ben will have the highest priority because he is older than Alex and Bob.

Ben Alex Bob

1st priority 2nd priority 3rd priority



State-3: When Dan arrives, she will be put as the last beaver to be served in the waiting list, because
she is the youngest.
Ben Alex Bob Dan

1st priority 2nd priority 3rd priority 4th priority

So the order the customers are served in is (Ben, Alex, Bob, Dan).
Answer A (Bob, Alex, Ben, Dan) is not correct, because the order of service is First Come, First Served,
which means it is purely according to the beaver’s arrival. However, this is not how the restaurant
chooses to serve their beavers.
Answer B (Dan, Bob, Alex, Ben) is not correct because the order of service is Last Come First Served,
which also is not how the restaurant has chosen to serve their beavers.
The answer C (Alex, Ben, Bob, Dan) is not correct because it does not consider who comes first, nor the
age of the beaver. The waiting list is ordered alphabetically by the beavers’ names.
Please note that there are no more customers after Dan, so the order of service is only for Alex, Ben,
Bob, Dan.

BACKGROUND INFORMATION
In computer science, there is a data structure called priority queue. The data structure representing the
waiting list of the beaver restaurant is called priority queue.
In an ordinary queue, all elements are managed as first-come-first-served or FIFO (First In First Out).
Whilst in a priority queue, an element with certain properties (priority) will be served first. In this
task, the priority is the age of the customer (the oldest one). The host of the restaurant manages all
customers on the waiting list as a queue, but she gives the priority to the oldest beaver even if the
oldest beaver arrives late.
This kind of queue gives each element priority to execute. The element with the highest priority is
executed before a lower priority element. If two elements have the same priority, they will be executed
according to the order of which they entered the queue.
Each time a service has finished, the host takes the top priority element in the list (dequeue). During a
service, new customers can come and join the queue (enqueue). The host should maintain the time of
arrival and the priority (in this task, the age of the beaver) of each element.
53
This question comes from Years 3+4
the Philippines Years 5+6 Medium
Years 7+8

Beaverly’s Food Bags


Years 9+10
Years 11+12

Beaverly’s company makes food bags containing acorns and mushrooms. Each food bag has 8 treats,
with the last one added by Beaverly herself following this rule:

• If there is an even number of , then she adds a mushroom .

• If there is an odd number of , then she adds another acorn

For example, if the first 7 treats are , then Beaverly adds a

mushroom to complete the food bag:


But, one evening, a naughty rodent sneaks into the company’s storehouse and leaves this note:

“I will swap an , from one of your food bags with a , from another food bag.”

The next morning, Beaverly quickly suspects these unusual-looking food bags:

• Food Bag 1:

• Food Bag 2:

• Food Bag 3:

• Food Bag 4:

Question
Help Beaverly identify the two food bags affected by the naughty rodent’s swapping.

Food Bags 1 and 3

Food Bags 2 and 3

Food Bags 1 and 4

Food Bags 2 and 4

Continued on next page


54
This question comes from Years 3+4
the Philippines Years 5+6 Medium
Years 7+8

Beaverly’s Food Bags – cont’d


Years 9+10
Years 11+12

EXPLANATION

Answer
The correct answer is Food Bags 2 and 3.

Explanation
To find the solution, we can think about the effect of the last treat added by Beaverly if the rules are
followed:
• If there is an even number of acorns among the first 7 treats, her addition of a mushroom does
not change the number of acorns. It also does not change the fact that there is an even number of
acorns inside the food bag.
• If there is an odd number of acorns among the first 7 treats, her addition of another acorn increases
the number of acorns by 1. Thus, the number of acorns now becomes even.
The key insight here is that every food bag should have an even number of acorns after Beaverly’s
addition. If the number of acorns is odd, then the food bag is certainly affected by the naughty rodent’s
swapping:
• Food Bag 1 has 4 acorns.
• Food Bag 2 has 3 acorns.
• Food Bag 3 has 7 acorns.
• Food Bag 4 has 2 acorns.
Since the problem states that only two food bags are affected, the correct answer is (B),
corresponding to Food Bags 2 and 3.

BACKGROUND INFORMATION
In computer science, particularly in the fields of information and coding theories, this task is known
as error detection, which is crucial since data unavoidably become corrupted as they are transmitted
across communication channels and networks. Notice that replacing all the acorns with 1’s and all the
mushrooms with 0’s results in bits (binary digits) of data.
One of the simplest error detection schemes is parity checking. Parity refers to whether a number is
odd or even. There are two variants of this technique: even parity and odd parity. In both modes, an
extra bit (either a 1 or a 0) — referred to as the check bit — is appended to the data. In the case of even
parity, the check bit is set to 0 if there is already an even number of 1’s; otherwise, it is set to 1. The
opposite happens in the case of odd parity. In this problem, the last treat added by Beaverly acts as an
even parity check bit.
Consequently, if even parity is employed and the stream of data (together with the check bit) contains
an odd number of 1’s, then an error flag is raised. For instance, sending 1000101 requires that an even
parity bit of 1 is appended: 10001011. If, for some reason, the second bit becomes corrupted during
transmission, transforming the data to 11001011, then the recipient is able to recognize the presence of
an error since 11001011 has an odd number of 1’s — a violation of the parity rule.
Parity checking only works if the number of corrupted bits are odd. This is the reason why this task
specifies that the naughty rodent swaps only a single acorn from one bag with a single mushroom from
another. Although this error detection technique does NOT tell us which bits are corrupted (that is,
which treats are swapped) nor does it provide us with any way to repair the data, it is still widely used
in some buses found inside the system unit (for example, PCI buses) for its efficiency.

55
This question comes from Years 3+4
Ireland Years 5+6 Medium
Years 7+8

Cupcakes
Years 9+10
Years 11+12

Bebras Bakery produces cupcakes for the hard-working hungry beavers in the town. Each cupcake is
decorated with three sweet layers. Firstly, each cupcake gets an icing layer, then a toppings layer, and
finally a fruit layer. Each of the layers is changed from one cupcake to the next.

The icing layer changes with the following pattern: green → white → red → blue
→[repeats again starting with green ]
The toppings layer changes with the following pattern: sprinkles → chocolate flakes → toasted nuts →
[repeats again starting with sprinkles]
The fruit layer changes with the following pattern: blueberry → cherry → kiwi → strawberry → orange
[repeats again starting with blueberry]

The picture above shows cupcakes on the production line at some point during the day, as they move
from left to right.

Question
What will the cupcake marked with “X” look like?

Continued on next page


56
This question comes from Years 3+4
Ireland Years 5+6 Medium
Years 7+8

Cupcakes – continued
Years 9+10
Years 11+12

EXPLANATION

Answer

The correct answer is Blue, sprinkles, orange.

Explanation
1. Red-sprinkles-orange - is not correct because cupcake “X” cannot have red icing.
2. White-chocolate flakes-kiwi - is not correct because cupcake “X” cannot have white icing.
3. Blue-toasted nuts-strawberry - is not correct because toasted nuts and strawberry would come
immediately before cupcake “X”.
Blue, sprinkles, orange is correct because:
• After white icing comes red and then blue, so cupcake “X” will have blue icing.
• After sprinkles comes chocolate flakes, then toasted nuts, then sprinkles, so cupcake “X” will have
sprinkles.
• After blueberry comes cherry, then kiwi, then strawberry, then orange, so cupcake “X” will have
orange.

BACKGROUND INFORMATION
This task illustrates the computational thinking concepts of algorithms and pattern recognition, and
the computer programming concept of remembering state.
Pattern recognition is the concept of finding patterns in the problem that will allow reuse in the
solution, either in the form of loops in the solution, or reusing parts of solutions from previously
solved problems. In this task, the sequence of options for each layer forms a pattern, but also there
is a pattern in the way that the application of each layer (icing, toppings, fruit) follows the same
fundamental algorithm.
An algorithm is a list of instructions. Following instructions is a very important concept in computer
science. This is how a computer works - we tell it what to do, and it follows these steps. For some
programming languages, the order of instructions is very important also. By changing the order, we
can change the output of the program. The sequence of ingredients in this task is very important for
each layer.
Remembering state is an essential part of many programming languages. A computer program can
store information, and affect its future behaviour, by changing its state. The most common way to
remember state in a computer program is to store a particular value in a variable.

57
This question comes from Years 3+4
South Korea Years 5+6 Hard
Years 7+8

Guess Who?
Years 9+10
Years 11+12

Jack and Jill are playing a quiz game that they made up. Both of them have the same 8 cards with a
picture of a person and their profession on them. Jack hides one of his cards and Jill must guess the
profession on the hidden card through several questions. Jill only asks one question at a time and Jack
can only answer with ‘yes’ or ‘no’.
These are Jack and Jill’s cards (left to right, top to bottom): doctor, scientist, astronaut, painter,
gardener, soldier, carpenter, business person.

Question
Jill tries to find the hidden card by creating a diagram like the one below.

Continued on next page


58
This question comes from Years 3+4
South Korea Years 5+6 Hard
Years 7+8

Guess Who? – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
The correct answer is doctor, scientist, astronaut, painter, business person, carpenter.

Explanation

Jill could find the hidden card after three questions using her own diagram.
• The profession that wears white, a lab coat and a stethoscope is the doctor.
• The profession that wears white, a lab coat but no stethoscope is the scientist.
• The profession that wears white, no lab coat and a helmet is the astronaut.
• The profession that wears white, no lab coat and no helmet is the painter.
• The profession that does not wear white, does not wear a green uniform but wears a suit is the
business person.
• The profession that does not wear white, does not wear a green uniform and does not wear a suit is
the carpenter.

BACKGROUND INFORMATION
This task demonstrates a tool called decision trees. Here it is being used for classification. For each step,
there is a classification based on one attribute. In the task, each feature takes one of two values (either
it is present or not).
The decision tree in this task is called a binary tree. The number of possible options after the next
question is reduced by half. So, to determine one option out of a million, 20 questions would be
enough, since 2 ^ 20 = 1048576> 1,000,000.
Decision trees are used in some simple automatic telephone robots that ask questions and offer to
press a number as an answer (interactive voice response systems). Decision trees are also a popular
tool in machine learning.

59
This question comes from Years 3+4
Lithuania Years 5+6 Hard
Years 7+8

Three Beavers
Years 9+10
Years 11+12

Three beavers are cutting down trees. Each beaver works alone. Each tree has a different thickness and
a different amount of time to cut them down.

Number of trees of the How many hours is needed


same thickness for cutting one tree
5 4
3 3
1 1

The beavers can cut down the trees in any order they want. But they have to finish the current tree
they are working on, before they start cutting down the next one. Also, two beavers can’t work on the
same tree.

Question
What is the shortest amount of hours needed for the beavers to cut down all the trees?

EXPLANATION

Answer
Correct answer is 11 hours.

Continued on next page


60
This question comes from Years 3+4
Lithuania Years 5+6 Hard
Years 7+8

Three Beavers – continued


Years 9+10
Years 11+12

Explanation
It might appear that the result would be 10 hours.

However, you cannot group the trees into three equal groups that allow each beaver to spend ten
hours cutting the logs.

As seen in the diagram, the three beavers cannot spend the same time. Two beavers are cutting trees
for 11 hours while the third only uses eight hours cutting trees.

We can see it in the next scheme:


Beaver 1: 4 hours + 4 hours + 3 hours = 11 hours

Beaver 2: 4 hours + 4 hours + 1 hour = 9 hours

Beaver 3: 4 hours + 3 hours + 3 hours = 10 hours

In this scheme, when a beaver finishes cutting a tree, it proceeds to cut the largest tree available.

The three beavers start cutting large trees (4 hours of work) when they finish, simultaneously, the
first two start with the last two large trees and the third beaver goes on to cut a medium tree. Since
the third beaver finishes earlier, he proceeds to cut a second medium tree. The first two beavers finish
later, simultaneously and choose, one the last medium tree and the other the only small tree. The first
beaver spends 11 hours at work, the second nine and the third ten.

In this case, the strategy followed has been to choose the largest tree available to continue the work.

BACKGROUND INFORMATION
A way of finding the schedule that yields the shortest time is to try all possible allowed schedules.
However, this is impractical in real-world situations; it might require a lot of computer resources. It
has been proven that that the scheduling problem is “NP-complete”. That means that it is probably not
possible to develop a computer program that can in each case find the optimal solution in acceptable
time.
However, for many problem instances, the beavers’ “greedy” strategy can be good enough, and has the
advantage that it is very quick to make a schedule and get the beavers working straight away. “Greedy”
means that the beavers start with the thickest trees (which require the longest cutting time) than cut
the second thickest trees and so on.
Carefully finding a problem instance to cause a strategy to perform poorly is a difficult, yet powerful,
technique to find the worst-case running time of a computer program as shown in this question. This
skill is called algorithm analysis and is used the field of computational complexity theory.

61
This question comes from Years 3+4
South Africa Years 5+6 Hard
Years 7+8

Glass Cabinet
Years 9+10
Years 11+12

Grandpa Beaver keeps his things neatly stored in a glass cabinet with one glass shelf for each kind of
object: books, scissors, pens and calculators.
Unfortunately, the young beavers have bumped into the glass cabinet and all of grandpa’s things have
fallen out.
The young beavers want to put grandpa’s things back as they were. Unfortunately they don’t remember
the order of the shelves, but they realise they can figure out the order by looking at the way the objects
are arranged after they fell, as shown below:

Question
Put grandpa’s things in the correct order, from top shelf to bottom shelf, by dragging the items
into place.

Continued on next page


62
This question comes from Years 3+4
South Africa Years 5+6 Hard
Years 7+8

Glass Cabinet – continued


Years 9+10
Years 11+12

Answer
(From top to bottom) Pens, Calculators, Books, Scissors.

Explanation
The approach to solving this question is deducing that the objects on the bottom shelf would’ve
landed first, and the objects on the top shelf would’ve landed last. One can imagine that the layers are
removed one by one from the top.
Top shelf: Pens – nothing obscures the view of the pens.
Second shelf: Calculators – once the pens are removed, nothing obscures the calculators.
Third shelf: Books – once the calculators are removed, the books are in plain view.
Bottom shelf: Scissors – These can clearly be seen to be under the books, with nothing under them.

BACKGROUND INFORMATION
In informatics, the order of things is very important.
There is an underlying data structure of a stack here: the top-most elements hide other elements
underneath them. For example, the pens are at the top of the stack, with the calculators under that
top element, and so on. Only the top-most elements can be viewed/removed from a stack. Stacks are
used in algorithms to manage subroutines: when a program calls a subroutine, we would like to return
to the “current state”, so that is pushed onto the stack.

63
This question comes from Years 3+4
the United Kingdom Years 5+6 Hard
Years 7+8

Robot Drawing
Years 9+10
Years 11+12

A school has a turtle robot that has a pen that draws lines when the robot moves.
The robot’s movement can be programmed in different ways using three different programming
systems:

North, South, East, Turn Right or Left Move to (x, y)


or West coordinates

The three sets of programming commands above make the robot draw the same picture.
The robot can only be programmed using whole numbers without decimals.

Question
Connect the pictures below to the correct programming system so that the robot can be programmed
to draw the three pictures using as few “move to (x, y) coordinates” programming commands as
possible. Each programming system can only be used to draw one picture. Connect points using 3 lines.

Continued on next page


64
This question comes from Years 3+4
the United Kingdom Years 5+6 Hard
Years 7+8

Robot Drawing – continued


Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
There are two constraints:
Must use each of the three programming systems
Avoid using as many move to (x, y) coordinates programming commands as possible.
The North South West East programming system can only move the robot horizontally or vertically.
That means that the hexagon and triangle can’t be drawn with this system, only the square can be
drawn with this system.
Students can use the Coordinates programming system for both of the remaining drawings. The
triangle has three points and thus needs three coordinate commands, the hexagon has six. This
means the triangle should be drawn with the coordinates programming system to satisfy the second
constraint. But this is only possible if the robot can draw a hexagon using the Turn Left and Right
system.
The hexagon can be programmed using the Turn Left and Right programming system because the turn
block allows the programmer to choose how far to turn. Because a hexagon has six of the same angles,
the robot repeats going straight and turning 60o a total of 6 times.

BACKGROUND INFORMATION
This task is about matching the best programming system for a problem given a number of constraints.
In computer science there are often multiple ways to solve a problem - for example, the coding
languages of Java and Python can both be used to create programs in many different circumstances.
However, Java is often the better choice when building a mobile application, while Python is often the
better choice when being used for data science projects. The unique features of each programming
language can inform which might be the better choice for a particular project, despite the fact it is
theoretically possible to use either.
We can see this in this task- all the shapes could have been programmed with either the Coordinate
system or the Left Right system. The North South West East system is not as universal.
65
This question comes from Years 3+4
Taiwan Years 5+6 Medium
Years 7+8

Bank Lock
Years 9+10
Years 11+12

In the Bebras Bank, the passcode to the safe is a combination of three out of eight symbols:

1 2 3 4 5 6 7 8

The passcode automatically changes every day. To change the passcode, each symbol is shifted to
the right. That is:
- The symbol is replaced by the symbol to the right.
- The rightmost symbol is replaced by the leftmost symbol.

For example, if on Sunday the passcode is , , , on Monday the passcode will be

, , .

Last Sunday, a bank manager set the passcode to , , . Then, the manager wrote a list of
passcodes for some days of the following week. However they made one mistake.

Question
Which of the passcodes is wrong?

Continued on next page


66
This question comes from Years 3+4
Taiwan Years 5+6 Medium
Years 7+8

Bank Lock – continued


Years 9+10
Years 11+12

EXPLANATION
Answer
The correct answer is:

Explanation
By following the rules for changing the daily passcode, the next week should look like this:

The original passcode on Sunday (524)

Wednesday (857)

Thursday
(168)

Friday
(271)

Saturday
(382)

Therefore, the passcode on Wednesday, Thursday, and Friday are correct. On Saturday, the passcode
should be (382), instead of (312).

This question can also be solved without working out the next weeks’ passcodes and instead by using
pattern recogntion:
We know the original passcode is 524. Therefore, the second symbol is always 5 ‘ahead’ of the first
symbol, and the third symbol is always 2 ‘ahead’ of the second symbol. This rule is followed by 857, 168,
271, but NOT 312 - the second symbols is 6 ‘ahead’ of the first symbol, and the third symbol is 1 ‘ahead’
of the second symbol.

BACKGROUND INFORMATION
While banks need to keep money safe, others want to keep information safe - in other words, hidden
from others. In history, people have utilised various encryption methods to keep their messages secret
to others.
The encryption method used in this example is the Caesar cipher: this method substitutes each letter of
a message by another letter, some fixed number of positions down the alphabetical order. This method
turned out to be unsafe and easy to crack. Relatively few encrypted messages need to be observed in
order to discover the system - when encrypting letters using this method, there are only a maximum of
25 ways to encrypt any message.
Modern computing uses modern encryption methods to safeguard important information. Their
design is very different from that of historic methods. Their system is well-known, but is based on
mathematical properties such that it can be proven that they are at least very hard to crack. However,
as technology improves, so to does its ability to break encryption methods. This constant dance
between creating better encryption techniques and finding methods to break them has been observed
all throughout history.
67
We would like to thank the International Bebras Committee and community for their ongoing assistance, resources
and collaborative efforts. Special thanks to Eljakim Schrijvers, Alieke Stijf and Dave Oostendorp for their support and
technical expertise.

If you would like to contribute a question to the International Bebras community, please contact us via the details below.

Contact us
CSIRO Digital Careers
[email protected]
csiro.au/Digital-Careers

Australia’s National Science Agency


Bebras Australia
Computational
Thinking Challenge
2022 Solutions Guide
Round 2

Secondary School
Grades 7–12 bebras.edu.au
Bebras Australia
Computational Thinking
Challenge
Bebras is an international initiative aiming The Bebras international community has now
to promote Computational Thinking skills grown to 60 countries with over 2.9 million
among students. ​ students participating worldwide!

Started in 2004 by Professor Valentina ​ ebras Australia began in 2014 and is now
B
Dagiene from the University of Vilnius, administered through CSIRO Digital Careers.
‘Bebras’ is Lithuanian for beaver. This refers
to their collaborative nature and strong In Australia, the Bebras Challenge takes place
work ethic. in March and August–September each year.
As of 2020, two separate challenges are
The International Bebras Committee meets offered for each round.
annually to assess potential questions and
share resources.​Questions are submitted To find out more and register for the
by member countries and undergo a next challenge, visit bebras.edu.au
vetting process.

Engaging young
423
minds for Australian schools

Australia’s
participated in
Round 2 2022

digital future 25,498


Australian students
participated in
Round 2 2022

CSIRO Digital Careers supports teachers and encourages students’ 2.9 million
understanding of digital technologies and the foundational skills Students participate
they require in an ever-changing workforce. Growing demand worldwide
for digital skills isn’t just limited to the ICT sector. All jobs of the
future will require them, from marketing and multimedia through
to agriculture, finance and health. Digital Careers prepares
students with the knowledge and skills they need to thrive in the
workforce of tomorrow.

csiro.au/digital-careers
2
What is a
Solutions Guide?
Computational Thinking skills underpin the careers of the future. Creating opportunities
for students to engage in activities that utilise their critical and creative thinking along with
problem solving skills is essential to further learning. The Bebras Challenge is an engaging way
for students to learn and practice these skills.

Within this Solutions Guide you will find all of the questions and tasks from Round 2 of the
Bebras Australia Computational Thinking Challenge 2022. On each page above the question
you will find the age group, level of difficulty, country of origin and key Computational
Thinking skills.

After each question you will find the answer, an explanation, the Computational Thinking
skills most commonly used, and the Australian Digital Technologies curriculum key
concepts featured.

3
Contents
What is a Solutions Guide? 3
What is Computational Thinking? 6
Computational Thinking skills alignment 7
Computational Thinking skills alignment 8
Australian Digital Technologies curriculum key concepts 9
Digital Technologies key concepts alignment 10
Digital Technologies key concepts alignment 11
Years 7+8 12
Boxes 13
Upcycling 15
Flooding 17
Robot Arm 19
Mouse Bot 21
Kayles Pins 23
Secret Message 25
Colouring Code 26
New Residents to Beaverland 28
Painting the Fence 30
Log 33
Compare 35
Kangaroo 38
Egg Queries 40
Museum Walking 42
Years 9+10 44
Alphabet Order Cypher 45
Hidden Chocolate 47
Cake 49
Bebras Runs 51
Lift 53
K-Pop Contest 55
Decorations 57
WhatDoesItDo 59
Ice Cream Machine 61
Secret Number 63
Ada’s Marble Machine 64

4
Smart Farm Robot 67
Unification 69
Symbol Reading Robot 71
Quiz Night 74
Years 11+12 77
Taking Leaves 78
Shop Counters 80
Sorting Beavers 82
Fruit Stack 84
Longest Sequence 87
Grocery Shopping 89
Jumping Jack 91
Counting by Nodding 93
Playing with Hats 95
Compact Representation 97
Save the Trees 99
Turing Machines 101
Mastermind 104
Truth Table 106
Log Sort 109

5
What is
Computational
Thinking?
Computational Thinking is a set of skills that underpin learning within the Digital Technologies
classroom. These skills allow students to engage with processes, techniques and digital
systems to create improved solutions to address specific problems, opportunities or needs.
Computational Thinking uses a number of skills, including:

DECOMPOSITION
Breaking down problems into smaller, easier parts.

PATTERN RECOGNITION
Using patterns in information to solve problems.

ABSTRACTION
Finding information that is useful and taking away any information
that is unhelpful.

MODELLING AND SIMULATION


Trying out different solutions or tracing the path of information to
solve problems.

ALGORITHMS
Creating a set of instructions for solving a problem or completing
a task

EVALUATION
Assessing a solution to a problem and using that information again
on new problems.

More Computational
Thinking resources
Visit digitalcareers.csiro.au/CTIA to download the Computational
Thinking in Action worksheets. These can be used as discussion
prompts, extension activities or a framework to build a
class project.
Each resource was designed to develop teamwork; critical and creative thinking;
problem solving; and Computational Thinking skills.

6
Computational Thinking
skills alignment
2022 Round 2 Grade Decomposi- Pattern Modelling &
Abstraction Algorithms Evaluation
Questions level tion Recognition Simulation

Years 7+8

Boxes Easy

Upcycling Easy

Flooding Easy

Robot Arm Easy

Mouse Bot Easy

Kayles Pins Medium

Secret Message Medium

Colouring Code Medium

New Residents to Beaverland Medium

Painting the Fence Medium

Logs Hard

Compare Hard

Kangaroo Hard

Egg Queries Hard

Museum Walking Hard

Years 9+10

Alphabet Order Cypher Easy

Hidden Chocolate Easy

Cake Easy

Bebras Runs Easy

Lift Easy

K-POP Contest Medium

Decorations Medium

Whatdoesitdo Medium

Ice Cream Machine Medium

Secret Number Medium

Ada's Marble Machine Hard

Smart Farm Robot Hard

Unification Hard

Symbol Reading Robot Hard

Quiz Night Hard

7
Computational Thinking
skills alignment
2022 Round 2 Grade Decomposi- Pattern Modelling &
Abstraction Algorithms Evaluation
Questions level tion Recognition Simulation

Years 11+12

Taking Leaves Easy

Shop Counters Easy

Sorting Beavers Easy

Fruit Stack Easy

Longest Sequence Easy

Grocery Shopping Medium

Jumping Jack Medium

Counting by Nodding Medium

Playing with Hats Medium

Compact Representation Medium

Save the Trees Hard

Turing Machines Hard

Mastermind Hard

Truth Table Hard

Log Sort Hard

8
Australian
Digital Technologies
curriculum key concepts
Abstraction
Hiding details of an idea, problem or solution that are not relevant, to focus on a manageable
number of aspects.
Data Collection
Numerical, categorical, or structured values collected or calculated to create information, e.g.
the Census.
Data Representation
How data is represented and structured symbolically for storage and communication, by
people and in digital systems.
Data Interpretation
The process of extracting meaning from data. Methods include modelling, statistical analysis,
and visualisation.
Specification
Defining a problem precisely and clearly, identifying the requirements, and breaking it down
into manageable pieces.
Algorithms
The precise sequence of steps and decisions needed to solve a problem. They often involve
iterative (repeated) processes.
Implementation
The automation of an algorithm, typically by writing a computer program (coding) or using
appropriate software.
Digital Systems
A system that processes data in binary, made up of hardware, controlled by software, and
connected to form networks.
Interactions
Human-Human Interactions: How users use digital systems to communicate and collaborate.
Human-Computer Interactions: How users experience and interface with digital systems.
Impact
Analysing and predicting how existing and created systems meet needs, affect people, and
change society and the world.

For more information on the Digital Technologies curriculum, please visit the
Australian Curriculum, Assessment and Reporting Authority (ACARA) website:
australiancurriculum.edu.au/f-10-curriculum/technologies/digital-technologies
9
Digital Technologies
key concepts alignment
Data Data Imple-
2022 Round 2 Grade Abstrac- Data Specifica- Algo- Digital Interac-
Represen- Interpre- menta- Impacts
Questions level tion Collection tion rithms Systems tions
tation tation tion

Years 7+8

Boxes Easy

Upcycling Easy

Flooding Easy

Robot Arm Easy

Mouse Bot Easy

Kayles Pins Medium

Secret Message Medium

Colouring Code Medium

New Residents
Medium
to Beaverland
Painting the
Medium
Fence

Logs Hard

Compare Hard

Kangaroo Hard

Egg Queries Hard

Museum
Hard
Walking

Years 9+10
Alphabet Order
Easy
Cypher
Hidden
Easy
Chocolate

Cake Easy

Bebras Runs Easy

Lift Easy

K-POP Contest Medium

Decorations Medium

Whatdoesitdo Medium

Ice Cream
Medium
Machine

Secret Number Medium

Ada's Marble
Hard
Machine
Smart Farm
Hard
Robot

Unification Hard

Symbol Reading
Hard
Robot

Quiz Night Hard

10
Digital Technologies
key concepts alignment
Data Data Imple-
2022 Round 2 Grade Abstrac- Data Specifica- Algo- Digital Interac-
Represen- Interpre- menta- Impacts
Questions level tion Collection tion rithms Systems tions
tation tation tion

Years 11+12

Taking Leaves Easy

Shop Counters Easy

Sorting Beavers Easy

Fruit Stack Easy

Longest
Easy
Sequence
Grocery
Medium
Shopping

Jumping Jack Medium

Counting by
Medium
Nodding
Playing with
Medium
Hats
Compact
Medium
Representation

Save the Trees Hard

Turing Machines Hard

Mastermind Hard

Truth Table Hard

Log Sort Hard

11
Bebras Challenge
2022 Round 2

Years 7+8
This question comes from Years 3+4
Romania Years 5+6
Years 7+8 Easy

Boxes
Years 9+10
Years 11+12

Penelope the Beaver has made wooden blocks of five different weights: 1 kg, 2 kg, 3 kg, 4 kg, and 5 kg.
The weight is written on each block.
Penelope is tidying up and wants to put all the block into three tall cabinets: Cabinet A, Cabinet B, and
Cabinet C.
Each cabinet can only hold a maximum weight of 15 kg.
Penelope can’t put a heavier block cannot on top of a lighter block, as it might crack the wood.
Penelope puts the blocks in the cabinets in the order that they are lined up, starting from the block on
the left shown below. For each block, Penelope always checks Cabinet A first, then Cabinet B, and then
Cabinet C, and will put the block in the first cabinet that it fits.

Question
Help Penelope to put all the blocks into the cabinets. Drag the blocks into the cabinets, following
the rules.

Continued on next page


13
This question comes from Years 3+4
Romania Years 5+6
Years 7+8 Easy

Boxes – continued
Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
By sticking to the rules, the blocks are placed as follows:

• The first block of weight 3 goes into Cabinet A.


• The second block of weight 2 will be placed over the block of weight 3 in Cabinet A.
• The block of weight 4 can’t be placed in Cabinet A as it would have to sit on top of a lighter block,
so it will be placed in Cabinet B.
• The block of weight 1 will be placed in Cabinet A, over the block of weight 2. While it is technically
allowed by the second rule to stack this block in Cabinet B or C, Penelope’s third rule says that a
block will be placed in the first cabinet where it can fit, which in this case is Cabinet A.
Continuing to follow these rules leads to the arrangement shown above.

BACKGROUND INFORMATION
A set of rules as seen in this question is what computer scientists call specifications. Based on these
specifications, programmers create an algorithm that corresponds to these specifications: a description
of the different steps someone would need to perform to solve the task, based on these specifications.
With these rules, there was no choice on where to put the blocks. The corresponding algorithm could
be described as follows, using ‘for’ and ‘if’ statements which are commonly utilised in computer
programming:
For each block starting from the left,
...For each cabinet starting with A, until you have placed the block,
......If the cabinet is empty, or the top block in the cabinet is heavier or as heavy as the block you
are trying to place then,
.........If the total weight of the blocks in the cabinet, plus the weight of your block, doesn’t exceed
15 kg, then,
............Place the block in this cabinet.
This is just one way to write the algorithm outlined in the question.

14
This question comes from Years 3+4
the United Kingdom Years 5+6
Years 7+8 Easy

Upcycling
Years 9+10
Years 11+12

Beavers hate waste. They like to use old worn out things as materials to make new useful items. This is
called upcycling.
Shown below are the materials required to make a wheel, a bicycle, a barrow, and a tricycle:

Doreen loves upcycling and likes to sell the items she is making. They can be sold at the market for
these prices:

Wheel: $1 Bicycle: $10 Barrow: $5 Tricycle: $15

Question
Doreen has these materials: 4 tyres, 4 iron bars and 1 wood piece.
What is the most money she can make by upcycling when she sells the items she makes?
Give your answer in the form of an integer.

x4 x4 x1

Continued on next page


15
This question comes from Years 3+4
the United Kingdom Years 5+6
Years 7+8 Easy

Upcycling – continued
Years 9+10
Years 11+12

EXPLANATION
Answer
$20.

Explanation
Doreen wants to maximise the profit she can make by using the materials in the most efficient way. For
example, the value of a tricycle ($15) is more than a bicycle and a wheel ($1+$10=$11), so Doreen should
aim to make a tricycle as it sells for $4 more while using the same materials.
A tricycle uses: 2 wheels and 1 iron bar (to make a bicycle), and another wheel.
3 wheels use: 3 tyres and 3 iron bars.
This leaves 1 tyre and 1 wood piece. The highest value item Doreen can now make is a barrow.
Total value of 1 tricycle + 1 barrow = $15 + $5 = $20.
This amount of $20 is the most money that Doreen can make. This occurs when she always tries to
build an item of the highest possible value, given what materials she has available. This works for the
values in this task but will not always work. For certain combinations of materials, Doreen might need
a different strategy to get the highest value in return.

BACKGROUND INFORMATION
Efficient use of resources is a common problem in society, that computer scientists are often asked to
write programs for to optimize. There are many algorithms used. Doreen used a Greedy Algorithm, so
called because the algorithm always tries to make the highest value items first. Although this works
in this particular case there are other situations where picking the highest value item first limits how
many other items you can make and does not get to the highest total value possible.

16
This question comes from Years 3+4
Portugal Years 5+6
Years 7+8 Easy

Flooding
Years 9+10
Years 11+12

In ancient times there was a small castle with thick black walls.
One day, it was destroyed by a big flood.

When a flood destroys a castle, it happens in the following way:

At the beginning After one hour After two hours

First, the water floods the exterior of the castle.


• After exactly one hour, every wall with water on one side and air on the other side breaks under
the pressure of water.
• Water then floods the new area, not bounded by any remaining walls.
• Now, there may be new walls having water on one side and air on the other. After another hour,
these walls also break down and water floods further. This procedure repeats until water has
flooded the entire area.
After the flood, the ancient Beaverian society built a new castle, shown below.

Question
How many hours would it take to flood the entire area of this new castle?

1 hour 2 hours 3 hours 4 hours 5 hours 6 hours

17
This question comes from Years 3+4
Portugal Years 5+6
Years 7+8 Easy

Flooding – continued
Years 9+10
Years 11+12

EXPLANATION
Answer
3 hours.

Explanation
According to the rules on how the castle floods, the process could be described by the following
images:
At the beginning:

After one hour:

After two hours:

After three hours:

BACKGROUND INFORMATION
Flood fill is an algorithm that determines and alters the area connected to a given starting point. It
is used in the bucket fill tool of paint programs to fill a bounded area with a specified colour, and in
games such as Go and Minesweeper for determining which pieces are cleared. This Bebras task shows
the effect of multiple flood fills. The number of necessary consequent flood fills determines also the
shortest distance from a starting point to a destination.

18
This question comes from Years 3+4
Germany Years 5+6
Years 7+8 Easy

Robot Arm
Years 9+10
Years 11+12

A class in Beaver High School have built a prototype of a robotic arm. The class have decided to test
the arm in the following way.

They place the arm on a table with two balls: one in tray A, and another in tray B. Tray C is empty.
The robot arm follows these steps in order:
1. Pick up the ball in A and put it in C.
2. Pick up the ball in B and put it in A.
3. Pick up the ball in C and put it in B.

Question
When the robot arm is finished, which of the following statements are true?

The balls have swapped places

There are two balls in tray A

There are two balls in tray B

Tray A is empty

Tray C is empty

Nothing has changed. Each ball is back in its place

Continued on next page


19
This question comes from Years 3+4
Germany Years 5+6
Years 7+8 Easy

Robot Arm – continued


Years 9+10
Years 11+12

EXPLANATION
Answer
“The balls have swapped places”, and
“Tray C is empty”.

Explanation
Following the steps described in the question, the robot arm moves the balls as shown in the
pictures below:

From this, each of the statements can be determined to be true or false:


• The balls have swapped places - True
• There are two balls in tray A - False, there is one ball in tray A
• There are two balls in tray B - False, there is only one ball in tray B
• Tray A is empty - False, there is one ball in tray A
• Tray C is empty - True
• Nothing has changed. Each ball is back in its place - False, the balls have swapped places.

BACKGROUND INFORMATION
To solve this task one needs to follow an algorithm - the steps in the given order, keeping track of the
state of the balls after each step.
The robot arm swaps the balls. Because it can only pick up one ball at a time, it has to put the first one
aside to make room for the second. It therefore needs three places for the exchange process.
For some programming languages, to swap two variable values a, b, the value of the first variable is
stored temporarily in a third c:
c=a
a=b
b=a
For numerical integer values, there is a procedure without a new third variable:
a=a+b
b=a–b
a=a–b
Some programming languages, for example Python, support multiple assignments using tuples,
like this:
a, b = b, a
20
This question comes from Years 3+4
Egypt Years 5+6
Years 7+8 Easy

Mouse Bot
Years 9+10
Years 11+12

Beaver Hajar has a programmable mouse bot. The bot has 4 arrows and a repeat button:

If Hajar would like to move the bot forward for 2 steps, she presses the Forward button twice.

She can also rotate the mouse 90 degrees to the right or left , or 180 degrees down by
pressing the corresponding buttons. The bot will rotate on the same tile.

If Hajar would like to repeat a sequence of moves, she will press the dark gray button in the middle -
when she presses this button, the bot will repeat the movement of all the inputs since the start of the
instructions or the last middle button press.
If she double presses the centre button, the bot will repeat the inputs twice. If she presses it 3 times,
the bot will repeat the inputs 3 times, and so on.

Question
Hajar has to program the mouse bot to reach the cheese. Choose the sequence that will do this.

Continued on next page


21
This question comes from Years 3+4
Egypt Years 5+6
Years 7+8 Easy

Mouse Bot – continued


Years 9+10
Years 11+12

EXPLANATION

Answer
The correct answer is

Explanation

1. The mouse will do the sequence of moving forward 3 times and a rotating 90 degrees to the right.
The mouse is now on the upper left corner and is facing towards the east.
2. Since the next step in the sequence is a repeat arrow, it will repeat the previous sequence. So the
mouse is now on the upper right corner and is facing towards the south.
3. After repeating the sequence for the third time, the mouse is now on the bottom right corner and is
facing towards the west.
4. The last arrow will move the mouse to the tile of the cheese.
Answer could be right if it has one more move forward arrow at the end. It
is a repeated pattern. It will move the mouse to the bottom right corner and facing towards the cheese,
but the mouse will not move to the cheese tile.

Answer will move the mouse one step forward, then will repeat this step
2 times. Now the mouse is on the upper left corner and is facing towards the north. Then it will rotate
90 degrees to the right, after which it will move one step forward. When the repeat button is executed,
it will repeat the rotate arrow and the forward arrow 2 times. So the mouse will be out of tiles and,
thus, off course.

Answer will move the mouse forward 3 steps. It will be on the upper left corner, but
it’s facing towards the west. So the next step will put the mouse off course.

BACKGROUND INFORMATION
An algorithm is simply a set of steps used to complete a specific task. They’re the building blocks for
programming, and they allow things like computers, robots, smartphones, and websites to function
and make decisions.
In addition to being used by technology, a lot of things we do on a daily basis are similar to algorithms.
Let’s say you want to make some spaghetti. In order to do this successfully, there’s a certain set of steps
you need to follow in a particular order.
First, you’ll need to boil a pot of water. Once it’s boiling, you then add the spaghetti and cook it for a
set amount of time, stirring occasionally. Once it’s finished, you drain the water, then it’s ready to be
served with a sauce of your choice.
22
This question comes from Years 3+4
Italy Years 5+6
Years 7+8 Medium

Kayles Pins
Years 9+10
Years 11+12

Marlee and Duane have invented a game using four bowling pins. They start by putting the pins in a
row, beside each other.

On their turn, they can either drop a single pin or two adjacent pins in one shot (they can always
choose which pin(s) to knock down). Whoever drops the last pin wins. Both Marlee and Duane can
ensure their victory if they always choose well.

Question
Considering that Marlee plays first, which pin or pins should she drop first to ensure her victory?

EXPLANATION

Answer

Explanation
Let’s number the pins from left to right.

1 2 3 4

Continued on next page


23
This question comes from Years 3+4
Italy Years 5+6
Years 7+8 Medium

Kayles Pins – continued


Years 9+10
Years 11+12

If Marlee knocks down the first pin, Duane wins by dropping the third pin. (Mirroring, if Marlee threw
down the fourth pin…)
If Marlee knocks down the first two pins, Duane wins immediately by dropping the last two pins left
standing. (Mirroring, if Marlee knocked down the last two pins…)
If Marlee knocks down the second pin, Duane wins by dropping the third pin, as in case A. (Mirroring,
if Marlee knocks down the third pin…)
By dropping the pair “second pin and third pin”, Marlee leaves only two detached pins; Duane can not
help but knock one of them down, leaving the other to Marlee!
Therefore, case D is the correct answer, as shown in the image above.

BACKGROUND INFORMATION
This question is based on the real game called Kayles - an impartial (combinatorial) game (i.e., a game
characterized by no distinction of “material” and no possibility of a draw). In general, given a row of
n(> 0) bowling pins, the two players take turns to knock out either one pin or two adjacent pins, until
all the pins have fallen down. Under the normal play convention, whoever throws down the last pin
wins; in this case, the first player has a winning strategy for any row of n (> 0) pins. Indeed, the first
player ensures victory by leaving the opponent two equal (and detached) sets of pins: if n is odd, the
first player throws down the central pin; if n is even, the first player knocks down the two center pins.
Whatever action the second player performs on one of the two sets in the following rounds, the first
player will “copy” it onto the other.
Kayles is a special case of the so-called “octal games”, that involve removing tokens from heaps of
tokens, possibly arranged in rows, stacks or other forms, generally modeled by means of a graph.

24
This question comes from Years 3+4
Serbia Years 5+6
Years 7+8 Medium

Secret Message
Years 9+10
Years 11+12

Beavers Bonnie and Clyde exchange messages consisting of 12 digits with 0’s and 1’s. Because Beaver
Ben understands their messages, they decided to encode them.
In the first encoding step they replace a pair of consecutive digits by a character A, B, C or D:

00 01 10 11

A B C D

In the second step, they replace a pair of consecutive characters using the system below:

AA AB AC AD BA BB BC BD CA CS CC CD DA DS DC DD

0 2 2 3 4 5 6 7 8 9 A B C D E F

Question
If Bonnie and Clyde’s final message is C13, what was the initial message in digits 0 and 1?

11 00 00 01 00 11 10 10 10 10 11 11 10 10 10 11 10 11 10 10 11 00 10 01

EXPLANATION
Answer
11 00 00 01 00 11.

Explanation
Let’s work backwards: C becomes DA, 1 becomes AB and 3 becomes AD, giving us DAABAD. Now, as D is
replaced by 11, A by 00 and B by 01, we get the final answer 11 00 00 01 00 11.

BACKGROUND INFORMATION
Cryptography is a science that deals with methods of preserving information secrecy. When a message
is transferred over an open channel from one place to another, anybody (in the case of our task
Ben) can read it. To protect its content, it is encrypted, which makes it not understandable. The basic
technique of hiding messages is encoding, which is what is happening in our task using a two-step
process. True encryption is more robust. To encrypt a message, the encoding should be parameterised
using a key – a shared secret between Bonnie and Clyde. A possible way parametrisation could be how
the second row of each table is permuted - the choice of key would change the order of the selections
in the table.
25
This question comes from Years 3+4
Saudi Arabia Years 5+6
Years 7+8 Medium

Colouring Code
Years 9+10
Years 11+12

The Beaver School of Art has created an exhibition using black and white squares called pixels.
The artists paint their pictures using a clever set of instructions.
An example of a picture of the letter “a” is shown below. The first number in each row always relates
to the amount of white pixels at the beginning of the row. If the first pixel is black the row begins with
a zero.

The next numbers alternate betwen white and black pixels. For example:
• 2,3,2,1 describes 2 white pixels, followed by 3 black pixels, followed by 2 white pixels, followed by a
black pixel.
• 0,3,4,5 describes 3 black pixels, followed by 4 white pixels, followed by 5 black pixels.

Question
What picture is painted with the following instructions?

15
5, 3, 7
4, 1, 3, 1, 6
3, 1, 5, 1, 5
2, 1, 7, 1, 4
1, 1, 4, 1, 4, 1, 3
1, 1, 3, 3, 3, 1, 3
1, 1, 4, 1, 4, 1, 3
2, 1, 7, 1, 4
3, 1, 5, 1, 5
4, 1, 3, 1, 1, 1, 4
5, 3, 3, 1, 3
12, 1, 2
13, 1, 1
15

Continued on next page


26
This question comes from Years 3+4
Saudi Arabia Years 5+6
Years 7+8 Medium

Colouring Code - continued


Years 9+10
Years 11+12

EXPLANATION

Answer

Explanation
To find the correct answer, we do not need to check the whole code.
• Since the first row in all images is the same, we can skip the first code line.
• The second code line starts with 5. Thus, the second row in the picture should start with a white
pixel. If it started with a black pixel, then the code would have to start with a 0 (according to
the rule about the first pixel in the row being black). However, the code does not start with a 0,
so option C is incorrect.
• The next two rows in the images A, B and D are identical, so we can also skip them.
• The fifth line of code has five numbers, but in image D there are seven segments of white and black.
Alternatively, in the middle of this code line there should be a 1 for the black pixel located in the
center of the fifth image – but the code calls for 7. So, option D is incorrect.
• The sixth code line has seven numbers, but in image A there are only five segments of black and
white. Also, the code line should include 9 to refer to nine white pixels, but it does not. So, option A
is also incorrect.
• Thus, we have option B as the correct answer. Just to be sure, we can check the sixth line of code,
with the sixth row in image B as follows:
– 1 – one white pixel
– 1 – one black pixel
– 4 – four white pixels
– 1 – black pixel
– 4 – four white pixels
– 1 – one black pixel
– 3 – white pixels
This is verified by the code, so we can be confident that B is correct.

BACKGROUND INFORMATION
Raster images are represented on screen as small dots in the form of a square. Those dots are called
pixels. Instead of storing the image as it is, computers use different compression algorithms to reduce
the amount of stored information. For example, lossy algorithms are based on the human psycho-visual
system feature to discard high-frequency information, i.e. sharp transitions in intensity, and color hue.
Although, high-frequency information will not be stored, the quality of the image will remain high.
Also, the size of these files will be reduced. It is possible to change the quality level, but a low level
may lead to the appearance of artifacts. JPG is one of the most popular raster image formats.
Another type of digital graphics is a vector image. This is drawn by lines (paths) with a starting and
ending points. Each path is represented as a mathematical expression. SVG is one of the most popular
vector image formats.

27
This question comes from Years 3+4
Cyprus Years 5+6
Years 7+8 Medium

New Residents to Beaverland


Years 9+10
Years 11+12

Four new families have applied for a construction license at the Bebrasland City Hall. The mayor has
allocated the families a single plot each inside a large area of land. The area is divided into 16 equal,
numbered plots as shown in the picture below:

The families can build their lodge inside their own plot, but they must follow four rules.
• Rule 1: Only one lodge can be built in a plot.
• Rule 2: There can be, at most, one lodge in each row of the area.
• Rule 3: There can be, at most, one lodge in each column of the area.
• Rule 4: There can be, at most, one lodge in each diagonal of the area – this is shown in the picture
above, where the highlighted square is a lodge (9), and the red lines show the other square areas
that are on the same diagonal (3,6,14).

Question
Select a plot for each of the four families to build their lodge that follows the rules.

Continued on next page


28
This question comes from Years 3+4
Cyprus Years 5+6
Years 7+8 Medium

New Residents to Beaverland – cont’d


Years 9+10
Years 11+12

EXPLANATION
Answer

Explanation
There are two solutions: 3 5 12 14 and 2 8 9 15, both with four ares for the bebras families to build nests,
as shown above. These solutions are mirror images of each other. Any other combination of four areas
violates at least one of the rules.

BACKGROUND INFORMATION
This is a simplified version of the 8 Queens problem with only 4 Queens. A solution can be found by a
backtracking method. A student places a nest in an area and then checks if there is a place for another
nest. If not, they change the place of the nest last placed and try again to place a new nest. If there is
no suitable position for a new nest, the position of the previously fixed nest must be changed and so
on. To be sure that the best solution is found, a student has to proceed by columns and in columns –
by rows.
The task can also be solved by trial-and-error.

29
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Medium

Painting the Fence


Years 9+10
Years 11+12

Beaver Jarrah wants to paint a 12-picket fence. They want to paint the fence red, orange, yellow, green,
blue and violet, where each colour is assigned to two fence pickets.

Jarrah has three buckets full of red, yellow, and blue paint, and three empty buckets for mixing.
The empty buckets are marked so that Jarrah knows when the bucket is one quarter full, half full,
and three quarters full. Each picket needs a quarter of a bucket of paint.
To get orange, green, and violet, Jarrah can mix the paint by following these rules:
• Red + Yellow = Orange
• Yellow + Blue = Green
• Red + Blue = Violet

Question
What is the maximum number of fence pickets can beaver Jarrah paint?

Continued on next page

30
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Medium

Painting the Fence – continued


Years 9+10
Years 11+12

EXPLANATION
Answer
The correct answer is 12.

Explanation
All 12 fence pickets can be painted. A quick check verifies that there are three full buckets of paint,
or 12 quarters. Each picket requires a quarter of paint, so all 12 pickets should be able to be painted.
However, we need to verify that the correct combination of colours can be achieved.
To do this, first, Jarrah has to paint two pickets red using half a bucket of red paint. Then they do the
same with four other pickets using half a bucket of yellow and blue paint respectively.

Now, there are three half-full buckets of paint left.


To paint two pickets orange, Jarrah needs to mix one quarter of the red-paint bucket and one quarter
of the yellow-paint bucket in the first empty bucket. As a result, Jarrah will get half a bucket of orange
paint.

After this step, there is one quarter bucket of red paint, one quarter bucket of yellow paint, and half a
bucket of blue paint.
Next, Jarrah can paint two pickets green by mixing one quarter of the yellow-paint bucket and one
quarter of the blue-paint bucket in the second empty bucket.

After this step, Jarrah mixes the remaining quarter of the red-paint bucket with the final one quarter of
the blue-paint bucket to get a half bucket of violet. Enough for the last two pickets.

Continued on next page

31
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Medium

Painting the Fence – continued


Years 9+10
Years 11+12

BACKGROUND INFORMATION
The main purpose of the RGB (red, green and blue) colour model is for the sensing, representation,
and display of images in electronic systems, such as televisions and computers. The RGB colour model
is an additive colour model in which red, green, and blue light are added together in various ways
to reproduce a broad array of colours. The name of the model comes from the initials of the three
additive primary colours, red, green, and blue. The RGB colour model is essentially opposite to the
subtractive colour model (RYB colour model), which this task illustrates.
In addition, in order to understand how computers store colour, one needs to understand “colour
coding”. A digital image, as it comes out of a digital camera or a scanner, can be stored on the hard disk
of your computer, processed, enhanced, retouched, and sent to a printer. A digital photograph consists
of pixels, a pixel being a coloured dot, the smallest element of the image. Each pixel has one and only
one colour. These colours are encoded as numbers.
RGB colour coding is probably the most prominent method of colour coding. Essentially, if you specify
three numbers between 0 and 255, assign one to R, one to G and one to B, you can define a colour.
For these three numbers, 0 means “none” and 255 means “all”. Remember that we are coding light,
not ink or paint or something like that. A higher figure means more light. The higher the RGB values,
the lighter the colour. The lower the RGB’s, the darker the colour. We set RGB to 0,0,0 to get black.
For example, RGB = 20,20,20 is a very dark grey, and RGB = 200,200,200 is a light grey.

32
This question comes from Years 3+4
Estonia Years 5+6
Years 7+8 Hard

Logs
Years 9+10
Years 11+12

Jack and Kalinda are building a log house.


Jack is bringing logs from the Forest to the Storage area. He can move from the Forest to the Storage
area in 5 minutes and drag 2 logs at the same time.
Kalinda is taking the logs from the Storage area to the Construction site. She can move from the
Storage area to the Construction site in just 2 minutes, but only carry 1 log.

Forest Storage area Construction site

Both beavers move at the same speed to and from the Storage area with or without logs. They are
working as follows:
• When Jack arrives at the Storage area with new logs, he will drop the logs and call out to Kalinda
before returning to the Forest; Kalinda will then stop working at the Construction site and take the
logs from the Storage area.
• When Kalinda takes the last log from the Storage area and returns to the house, she will resume
doing her work at the Construction site; but if there are logs left at the Storage area, Kalinda will
drop the log at the house and immediately return for more logs to the Storage area.

Question
Jack starts in the Forest, and Kalinda starts at the Construction site. How many logs will be at most at
the Construction site 30 minutes after the friends start working?

Continued on next page


33
This question comes from Years 3+4
Estonia Years 5+6
Years 7+8 Hard

Logs – continued
Years 9+10
Years 11+12

EXPLANATION
Answer
The correct answer is 5.

Explanation
In 30 minutes, Jack will have enough time for three runs from the forest to the storage area and back.
More concretely, he will arrive with two new logs 5, 15, and 25 minutes after the start.
When Jack arrives with the first two logs 5 minutes into the workday, the storage area is empty and he
will call Kalinda. It will take Kalinda 2 minutes to get to the storage area, so she will get the first of the
two logs to the construction site at 9 minutes and the second one at 13 minutes. She will then resume
other work.
The process repeats itself when Jack arrives with the next two logs at 15 minutes. Kalinda gets those to
the construction site at 19 and 23 minutes, respectively.
Out of the third pair of logs that Jack brings to the storage area at 25 minutes, only the first will be at
the construction site by the half-hour mark, as Kalinda will drop this log off at the 29 minute mark and
not have enough time to return to get the remaining log. This brings the total number of logs at the
construction site to 5.

BACKGROUND INFORMATION
The way the two friends are working is similar to the producer-consumer model of parallel processing
in computers. Jack is the producer of logs for Kalinda, and Kalinda is the consumer of the logs that Jack
has produced.
The storage area acts as a buffer so that Jack does not have to wait until Kalinda comes to collect the
logs; instead, Jack can return to forest for the next pair of logs immediately and be more productive.
Jack calling out to Kalinda when he adds new logs to the empty storage area is like the signals used in
computer systems to allow one program to alert another. This lets Kalinda do other work instead of just
waiting at the storage area. However, when Jack does call to Kalinda, it takes some time for Kalinda to
go from the construction site to the storage area, causing latency in the movement of logs.
A difference of our task from the classical producer-consumer model is that in our case all the logs are
considered equal and it is not required for Kalinda to bring the logs to the construction site in the same
order as Jack collected them in the forest.

34
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Compare
Years 9+10
Years 11+12

Four beavers Ada , Berta , Cezar , and Dan are playing with a scale and took
many photos. Three of the photos are shown below:

Continued on next page


35
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Compare – continued
Years 9+10
Years 11+12

Question
Which of the following photos could also have been taken?

EXPLANATION

Answer

Explanation
One way to solve this task is by using deductive reasoning:

If this photo was true, then Ada also weighs the same as Cezar from the middle photo. In which case, in
the lower photo, the scale should have been balanced (Ada+Dan = Berta+Cezar). This is a contradiction
so the assumption of first photo cannot be true.
Continued on next page
36
This question comes from Years 3+4
Lithuania Years 5+6
Years 7+8 Hard

Compare – continued
Years 9+10
Years 11+12

If this photo was true, then Berta also weighs the same as Dan from the middle photo. The above
argument still applies - the scale in the lower photo should have been balanced (Ada+Dan =
Berta+Cezar). Therefore, the assumption of second photo cannot be true.

If this was true photo, then Berta weighs more than Dan (Berta > Dan). Cezar must weigh more then
Ada (Cezar > Ada) to keep the scale balanced in the middle photo. This means in the lower photo, it
cannot be true that Berta+Cezar together weigh less than Ada+Dan. As a matter of fact, it should be the
other way around. Therefore, the assumption of the fourth photo cannot be true.

If this photo was true, then Cezar weighs less than Ada (Ada > Cezar). Berta must weigh less than Dan
(Berta < Dan) to keep the scale balanced in the middle photo. There is no contradiction that Ada+Dan
weigh more than Berta+Cezar as shown in the lower photo. Subsequently there is also no contradiction
that 20kg is enough to balance the scales in the top photo. Therefore, this photo is allowed and is the
correct answer.

BACKGROUND INFORMATION
Logical reasoning is fundamental to computer science. Essentially, a computer program is an
implementation of logical steps that lead to a solution of the problem at hand. But logical reasoning is
not only important in programming, computer scientists often use logical and mathematical analysis to
determine the complexity of a program and to prove the correctness of the program.
By finding contradictions like in this question, programmers are able to find bugs in their code,
or identify and change the way they plan to create a program.

37
This question comes from Years 3+4
Uzbekistan Years 5+6
Years 7+8 Hard

Kangaroo
Years 9+10
Years 11+12

Kangaroo Mae (M) needs to reach Kangaroo Claire (C). To achieve this, Mae needs to jump on little
green islands in a swamp. The swamp is represented as a grid as shown below.
Mae can only perform two kinds of jumps: short and long. Short jumps are to move from a cell to
any of four neighbouring cells. Long jumps are to jump straight over any of four neighbouring cells.
The images below show short jumps on the left and long jumps on the right:

Mae cannot make any other jumps (diagonal moves, jumps over two or more cells, etc). Long jumps are
more tiring and dangerous, so she cannot make two consecutive long jumps.

Question
Find the way for Mae to reach Claire by clicking on the cells in the exact order of Mae’s jumps.
The last clicked cell must be Claire’s cell.

Continued on next page


38
This question comes from Years 3+4
Uzbekistan Years 5+6
Years 7+8 Hard

Kangaroo – continued
Years 9+10
Years 11+12

EXPLANATION

Answer
The picture below shows the solution to the problem.

Explanation
All the possible cells that Mae can visit are highlighted. The correct path is in red, while all other
accessible paths that lead to a dead-end are in grey.
One way to solve this problem is via trial-and-error modelling. Whenever Mae reaches a tile that
can branch off in multiple paths, one route is selected. If this route ends in a dead-end, the path is
backtracked to the fork, and the other path is chosen. If all routes in the fork are dead-ends, then the
path is backtracked to the previous fork, and so on.

BACKGROUND INFORMATION
This question can be approached using a Depth-First Search (DFS) algorithm. Like Breadth First Search,
which looks for all of the nodes in a graph that satisfy a certain condition, Depth-First Search is a
graph algorithm. Its principle is to fully explore a path before moving on to the next. From a vertex, it
is about exploring a path until reaching a dead end or a vertex already visited. DFS is often expressed
recursively.
A DFS strategy is outlined in the answer explanation of the question - searching down a route, and if a
dead-end is reached, backtracking to the previous fork and trying the next possible path, and so on.
39
This question comes from Years 3+4
the Netherlands Years 5+6
Years 7+8 Hard

Egg Queries
Years 9+10
Years 11+12

Mary painted six Easter Eggs as shown in the image below.

Sian chooses one of them, without telling Mary her choice.


In order to guess which egg Sian selected, Mary is allowed to ask two questions from the following:
• Is your egg thin or wide? (shown in blue below)
• Does your egg have a red top and bottom, or red triangles on its face? (shown in red below)
• Does your egg have open or closed eyes? (shown in green below)

Question
Which combination of questions offers the best chance to be able to identify the chosen egg,
regardless of what egg Sian chose?

It does not matter

Continued on next page


40
This question comes from Years 3+4
the Netherlands Years 5+6
Years 7+8 Hard

Egg Queries - continued


Years 9+10
Years 11+12

EXPLANATION
Answer
It does not matter.

Explanation
The images on the right of each option below show that two possible combinations can identify the
one possible egg, but there are two other combinations that leave two possible eggs.
This means that by asking two questions, it is possible to distinguish only four different types of eggs.
But there are six eggs. So there is a possibility not to identify the egg that Sian chose. It doesn’t matter
which combination of questions is chosen - they will always split the eggs into two groups of two eggs,
and two groups of one egg. Therefore, the correct answer is that it does not matter which questions
Mary decides to ask!

BACKGROUND INFORMATION
For many situations in both computer science and in other real world places there are groups of objects
with binary attributes - characteristics that are one of two options. With n attributes, it is possible to
distinguish 2n different instances. For example, for an egg that can be big or small, and either red or
blue, there are 22 = 4 possible eggs that could exist.
Each attribute can be described using a bit, a binary digit (0 or 1). In analysing algorithms for searching
through these objects, understanding these binary distinctions is needed. It is also possible to express
these distinctions as booleans (logical variables ‘true’ or ‘false’ instead of 0 and 1).
41
This question comes from Years 3+4
Russia Years 5+6
Years 7+8 Hard

Museum Walking
Years 9+10
Years 11+12

Here is a plan of one section of the Louvre in Paris, France. Victoria arrives, entering from the black
arrow. She wants to visit each room and view the artifacts in order based on the following rules:
• Every time she arrives in a room, she will check if there is an unvisited adjacent room:
– If so, she will immediately move to the unvisited adjacent room with the smallest possible
number.
– If not, she will view the artifacts in the current room.
• When she finishes viewing the artifacts in a room, she will return to the last room she came from
and repeat the above steps.
– Victoria will never return to a room where she has viewed the artifacts, even if she just came
from there - she will instead return via the next most recent way she entered the room she is in.

Question
Trace Victoria’s steps through each room and mark in which order she views the artifacts.

Continued on next page


42
This question comes from Years 3+4
Russia Years 5+6
Years 7+8 Hard

Museum Walking – continued


Years 9+10
Years 11+12

EXPLANATION

Answer

Explanation
The above image shows the order in which Victoria views the artifacts. In the beginning, Victoria is in
room 130, and there are 2 unvisited adjacent rooms, 129 and 131. She then visits room 129 where there is
no unvisited adjacent room, so she views the artifacts there and returns to room 130.
Similarly, from room 130, she visits 132 → 133 → 134 → and arrives in room 135 where there is no
unvisited adjacent room, so she views the artifacts there and returns to room 134.
Then from room 134, she visits 136 → 137 → 138 → 140 → 142→ 143 → 141 → and arrives in room 139
where there is no unvisited adjacent room, so she views the artifacts there and returns to room 141.
Then she views the artifacts in room 141 and returns to room 143. From room 143, she visits room 144,
the last unvisited room. After viewing the artifacts in room 144, she returns to room 143. She views the
artifacts in this room, and then returns to 142, as this was the most recent way she came in where she
is returning to a room with unvisited artifacts. She then views artifacts in each room in reverse, all the
way back to room 130.

BACKGROUND INFORMATION
The way Victoria searches for unvisited rooms is based on an algorithm known as Depth-First-Search
(DFS) algorithm. Alongside the Breadth-First-Search algorithm, it is a common way to go through the
data structure organized as a graph if we don’t want to miss any of its elements.
Its principle is to fully explore a path before moving on to the next. From a vertex, it is about exploring
a path until reaching a dead end or a vertex already visited.

43
Bebras Challenge
2022 Round 2

Years 9+10
This question comes from Years 3+4
Turkey Years 5+6
Years 7+8

Alphabet Order Cypher


Years 9+10 Easy
Years 11+12

The Beavarian Astronomy Society has developed an algorithm for encryption. An encrypted word has
two parts: the first part consists of the numerical value of the word to be encrypted, and the second
part consists of the alphabetical order of each letter in the word. They use the table below for all
encryption operations:

A B M N O R S T U

1 2 4 10 50 180 300 650 960

For example, the word “MARS” is encrypted as follows:


• The numerical value of the word is equal to the sum the corresponding values of the letters in the
table (4+1+180+300= 485).
• In the word MARS, if we order all letters alphabetically we have A-M-R-S. The alphabetical order
index is A=1, M=2, R=3, S=4, which gives 2134.
Therefore, the encryption for the word MARS is 485;2134.

Question
If the word SATURN was encrypted using the same algorithm, which of the following would be the
correct encryption?

1440;415632 1440;718964 2101;415632 2101;718964

EXPLANATION
Answer
2101;415632.

Explanation
The solution can be found by directly following the encryption algorithm. However, there are shortcuts
to arrive at the correct option faster:
First we check the first part of the code - a sum of the encrypted letters. There are two possible
answers: 1440 and 2101. The word SATURN contains the letters T and U from the right side of the table
with very big numbers, 650 and 960. It is visible that the sum of just these two numbers is bigger than
1440. So the correct sum must be 2101.
The second part of answers contains only two possibilities: 415632 and 718964. SATURN has 6 letters
and the ciphers in the code refer to the positions of the letters. It is impossible for the cipher to include
a number 7 or greater (in the word SATURN there is no letter in 7-th place). So 718964 is wrong and
415632 must be correct.
Answers A is incorrect because the first part of the code is incorrect.
Answer D is incorrect because second part of the code is incorrect.
Answer B is incorrect because both parts of the code are incorrect.

Continued on next page


45
This question comes from Years 3+4
Turkey Years 5+6
Years 7+8

Alphabet Order Cypher – cont’d


Years 9+10 Easy
Years 11+12

To prove that answer C is indeed correct, the full algorithm can be performed:
First part: S=300, A=1, T=650, U=960, R=180, N=10. Total value = 300+1+650+960+180+10= 2101.
Second part: alphabetical order of letters in the word is S=4 A=1 T=5 U=6 R=3 N=2 and the code
is 415632.
Hence the encryption is 2101;415632.

BACKGROUND INFORMATION
This problem uses the idea of a transposition cipher in combination with the use of a checksum for
encoding. In a transposition cipher, the letters are reversed, and the key indicates the correct order of
the letters. Message checksums are used for encoding rather than encryption. Checksums help us to
identify errors caused by interference in the transmission of messages.

46
This question comes from Years 3+4
New Zealand Years 5+6
Years 7+8

Hidden Chocolate
Years 9+10 Easy
Years 11+12

Four students, Arjun, Ben, Charlie and Dian decided to play a prank by hiding their teacher’s chocolate.
When the teacher realised that the chocolate was missing, they asked the four students, “Which one of
you hid the chocolate?”.

The students gave the following answers:


• Arjun: I didn’t hide the chocolate.
• Ben: I know that Dian didn’t hide the chocolate.
• Charlie: Amy hid the chocolate.
• Dian: Either Ben or Charlie hid the chocolate
The chocolate was hidden by a single student. Only one student’s statement is true - the other three
students are lying.

Question
Which student hid the teacher’s chocolate?

Arjun Ben Charlie Dian

EXPLANATION
Answer
Dian. The answer Arjun was also accepted*.

Explanation
The answer can be found by considering the outcomes of whether each student hid the chocolate. For
example, the proposition “Arjun hid the chocolate” can be represented by PA and the proposition that
“Arjun didn’t hide the chocolate” can be represented by ¬PA . By formal logic, PA and ¬PA cannot be
simultaneously true.
The four statements that each of the students make can now be represented in this new format as
shown below (with the symbol in brackets indicating what is true if the student is lying):
Arjun ¬PA ( PA)
Ben: ¬PD (PD)
Charlie: PA (¬PA)
Dian: PC v PD (¬( PC v PD))
for Dian, ‘v’ means ‘or’ (either Charlie OR Dian hid the chocolate), so if Dian is lying the symbols mean
Charlie OR Dian didn’t hide the chocolate.
Continued on next page
47
This question comes from Years 3+4
New Zealand Years 5+6
Years 7+8

Hidden Chocolate – cont’d


Years 9+10 Easy
Years 11+12

Now we can work through the possibilities of who is telling the truth. Only one student’s statement can
be true:
• If Arjun is telling the truth, then Charlie is lying and that re-enforces it wasn’t Arjun. Ben is lying so
that means Dian hid the cholate. This is supported by Dian’s lie which leads to neither Ben or Charlie
having taken the chocolate. There is no contradiction here.
• If Ben is telling the truth, both Arjun and Charlie are lying so we have (PA) and (¬PA) –
a contradiction.
• If Dian is telling the truth, Arjun and Charlie are lying so again, a contradiction.
• If Charlie is telling the truth, then both Arjun (who is lying) and Charlie’s statements would lead to
Arjun hiding it. But Ben is also lying, which means PD. This means both Dian and Arjun would have
hidden it and again we have a contradiction as only one student hid the chocolate.
Only the situation where Arjun is telling the truth doesn’t result in a contradiction. If Arjun is the
only student telling the truth, then the one truth and three lies means that Dian took the chocolate.
Therefore, Dian is the correct answer.
*The answer Arjun was also accepted. Charlie’s statement was intended to read “Arjun hid the chocolate”
and not “Amy hid the chocolate”. However, due to this typo in the question text, students who interpreted
Amy as an additional character could reasonably arrive at a solution where only Ben is telling the truth
and hence Arjun hid the chocolate. These students were also marked as correct and were not penalised.

BACKGROUND INFORMATION
The concept of a condition being True or False is used in programming. For example, a program may
check if some variable x is either equal to 3 (x==3) if x is not equal to 3 (x!=3) and perform a different
action depending on which statement is true. Similarly, the concept of two things being joined with an
‘or’ is a basic concept in programming.
The device used to explain the correct answer is called propositional logic. It has its roots in both
Philosophy and Mathematics but is also often studied by Computer Scientists. Computer Science is a
discipline in which the objects that we want to reason about are extraordinarily complex, and are often
abstract and formal. Therefore, there is a need for logic to be especially clear - breaking a problem
down using propositional logic can help simplify the task. It has many practical applications such
as in the design of computing machines, artificial intelligence, the definition of data structures for
programming languages, and in many more areas.

48
This question comes from Years 3+4
Pakistan Years 5+6
Years 7+8

Cake
Years 9+10 Easy
Years 11+12

Bruna has two open cartons of 1L of milk, each of them being slightly more than half full. She wants to
make a cake and needs to measure exactly 700ml of milk into one of the two cartons. She also has an
empty bottle of 500ml and an empty cup of 100ml.
In the process of obtaining exactly 700ml, Bruna can completely fill or empty any of the
four containers.

1 2 3 4

Question
Bruna represents four possible sequences of pouring milk using the symbols below. Two items
connected by an arrow means that Bruna pours the contents of the first container (left) into the second
(right) until this last container is full or until the first is empty, whichever happens first.
Which of the sequences is both the shortest and succesfully measures exactly 700ml into one
of the cartons?

(1)(4); (1)→(3); (1)→(2); (3)→(1); (4)→(1); (2)→(4); (4)→(1)

(1)→(2); (2)→(3); (3)→(4); (4)→(2); (3)→(4); (4)→(2)

(2)→(3); (2)→(1); (3)→(2); (1)→(4); (4)→(2); (1)→(4); (4)→(2)

(1)→(4); (4)→(2); (1)→(4); (4)→(2)

Continued on next page


49
This question comes from Years 3+4
Pakistan Years 5+6
Years 7+8

Cake – continued
Years 9+10 Easy
Years 11+12

EXPLANATION
Answer
(1)→(2); (2)→(3); (3)→(4); (4)→(2); (3)→(4); (4)→(2)

Explanation
By following the sequence in option (B), which is (1)→(2); (2)→(3); (3)→(4); (4)→(2); (3)→(4); (4)→(2),
Bruna succesfully ends up with 700ml in one of the cartons:
First, she fills the second pack to 1000ml, then pours 500ml into a third bottle. Then, using the fourth
bottle, she pours 100ml twice into the second container. This means that there is exactly 700ml in
carton 2. In total, this sequence used 6 pours.
To verify this is the correct answer, the other options need to be checked:
• In sequence (A) we cannot be sure that the 500ml bottle will be filled with milk, because after
pouring 100ml from the first pack into the 100ml recipient we do not know for sure that we still
have 500ml in the pack - therefore this sequence doesn’t achieve Bruna’s goal and is incorrect.
• In sequence (C) one of the cartons ends up with 700ml, but it takes 7 pours - one more pour than
option (B).
• In sequence (D) we do not know exactly how much milk was initially in the second carton, we only
know it had a little more than 500ml. So after pouring 100ml twice into the second carton there will
be slightly more than 700ml. Therefore, this sequence is incorrect.
In reality, once (B) is verified to be a sequence that results in 700ml in one of the cartons, only
sequence (D) needs to be checked to verify that (B) is the right answer, because sequences (A) and
(C) are longer than (B).

BACKGROUND INFORMATION
This task is related to the concept of an algorithm, a sequence of instructions needed to perform some
task - in the particular question, the task is to obtain 700ml of milk in one of the available recipients.
All computers work by executing sequences of instructions in order to run their system as well as to run
applications.
Algorithms can often become complex and long for large applications. Computer Scientists often
represent steps in the algorithm using symbols which makes the flow of the application easy to
understand and interpret - this can help identify bugs and reveal parts of the algorithm that can be
optimised. This is the essence behind many coding languages - block coding is a prime example of
creating an easy-to-understand representation of complex algorithms.

50
This question comes from Years 3+4
Poland Years 5+6
Years 7+8

Bebras Runs
Years 9+10 Easy
Years 11+12

A fellowship of nine beavers must solve a riddle to open an ancient door on their quest. To open the
doors, the beavers must sort a sequence of numbers from smallest to largest. Beaver Boromir believes
he has a great idea that can sort any list of numbers they encounter. He goes through the list of
numbers from left to right and performs the following steps:
• He compares the current number with the next number in the list.
• If the next number is smaller than the current number he swaps them.
• He moves to the next position in the list and repeats the steps above.
• When he reaches the end of the list, this is called one pass.
Boromir performs one pass on the following list of numbers:

5 3 5 6 7 4 3 6 8 4

The steps that Boromir performs in the first pass are highlighted below.
3556743684
3556743684
3556743684
3556743684
3556473684
3556437684
3556436784
3556436784
3556436748

After he has finished the first pass, the list of numbers looks like this:

3 5 5 6 4 3 6 7 4 8

Question
What does the list of numbers look like after two more passes?

EXPLANATION
Answer
3543564678.

Continued on next page


51
This question comes from Years 3+4
Poland Years 5+6
Years 7+8

Bebras Runs – continued


Years 9+10 Easy
Years 11+12

Explanation
Performing two more passes leads to the following list order:
3556436748
3556436748
3556436748
3554636748
3554366748
3554366748
3554366748
3554366478
3554366478

And,

3554366478
3554366478
3545366478
3543566478
3543566478
3543566478
3543564678
3543564678
3543564678

Therefore, the sequence will be the following after the fellowship of beavers make two more passes:

3 5 4 3 5 6 4 6 7 8

BACKGROUND INFORMATION
Ordering lists of data is a common problem in computer science. This question demonstrates an
algorithm called a bubble sort. This algorithm makes passes through the data and swaps adjacent
entries if it satisfies a certain condition - in this question, if the number on the right is smaller than the
number on the left.
This is just one of many sorting algorithms that exist. The bubble sort is a great demonstration of these
types of algorithms as it is one of the most simple. However, simple algorithms like this often take lots
of time to sort lists as they become longer. Other more complex algorithms such as quicksort can order
data faster than the bubble sort.

52
This question comes from Years 3+4
Slovakia Years 5+6
Years 7+8

Lift
Years 9+10 Easy
Years 11+12

There is a lift at school. Nick , Lily , Kate , Mike and Jack all take a trip on the lift.
On this trip, the lift started from the ground floor (0), went up to the top floor (4), and then went back
down to the ground floor. Along the way, it made several stops. The image below shows who was in
the lift between each of the floors:

Question
Which of the following statements is true?

Jack went from the top floor (4) to the ground floor (0)

Mike was the only person to take the lift for one floor

Two people left the lift at the first floor (1)

Jack and Kate each took the lift to go three floors

Continued on next page


53
This question comes from Years 3+4
Slovakia Years 5+6
Years 7+8

Lift – continued
Years 9+10 Easy
Years 11+12

EXPLANATION

Answer
Jack and Kate each took the lift to go three floors. Kate went from floor 3 to floor 0, and
Jack went from floor 4 to floor 1.

Explanation
The statement Jack and Kate each took the lift to go three floors is true as Kate went from floor 3 to floor
0, and Jack went from floor 4 to floor 1.
Let us look at the other statements as well:
1. A) Jack went from floor 4 to floor 0. It is false because Jack went from floor 4 to floor 1 when the lift
went back down. Between floor 1 and floor 0, only Kate was in the lift.
2. B) Only Mike took the lift to go one floor only. It is false because Lily did so, too. She went from floor
2 to floor 1, while Mike went from floor 0 to floor 1 with the lift going up.
3. C) Two people left the lift at floor 1. When the lift was going up, Mike left the lift at floor 1. When the
lift was going down, Jack and Lily left at floor 1. Therefore, three people left the lift at floor 1.

BACKGROUND INFORMATION
In informatics we usually need to deal with data about some situation. In this task there were two
types of information – one picture of a building with people waiting for the lift, and diagram in which
we saw how people used it. Even though there were no implicit information about who was in the lift
for three floors, who left it where, or who was the first or last one in it, we could simply deduce it by
reading the diagram.
Diagrams representing the changes of a system are often parts of problem specification which have
to be programmed. It’s easier to use them compared to writing down all information we have. In
diagrams like this one there are states (in this task a position of the lift and its direction) and transitions
between them (who was in the lift between two states). With the help of transitions, we can say who
was in the lift and when.
Reading the diagram is a skillset that can be used often in everyday life, e.g., as part of operating
instructions for various home appliances.

54
This question comes from Years 3+4
South Korea Years 5+6
Years 7+8

K-Pop Contest
Years 9+10 Medium
Years 11+12

A singing contest was held in Beaver Village with six singers in the final round.

Four experts were invited to judge them. Each expert gave points according to their own criteria.
The score table looks as follows:

Judges
Jin Hope Rosé Jungkook
Singers
Anna 80 8 60 0
Betty 90 10 80 50
Carrie 85 7 90 100
Dennis 100 9 100 30
Elin 95 6 70 10
Frank 75 5 50 20

The organisation decided to rank the singers in each of the judge’s lists according to the given scores as
1st, 2nd, 3rd, etc. For example, if a singer finished 4th, 2nd, 3rd and 6th on the judges’ lists respectively,
they would score a total of 4+2+3+6=15.
The winner of the contest is then determined by the smallest sum of all the rankings.

Question
Who is the winner?

Anna Betty Carrie Dennis Elin Frank

Continued on next page


55
This question comes from Years 3+4
South Korea Years 5+6
Years 7+8

K-Pop Contest – continued


Years 9+10 Medium
Years 11+12

EXPLANATION

Answer
The correct answer is Dennis.

Explanation
First of all the organiser had to rank all six singers in each judge’s list. It means that a singer who had
the highest score got #1 ranking; a singer with the lowest score got #6 ranking. Assigned rankings are
provided in brackets (in the table below). Next, the organizer had to add up each singer’s rankings and
to find the smallest sum. This condition is fulfilled by Dennis who became the winner.

Judges Sum of
Jin Hope Rosé Jungkook
Singers rankings

Anna 80(5) 8(3) 60(5) 0(6) 19


Betty 90(3) 10(1) 80(3) 50(2) 9
Carrie 85(4) 7(4) 90(2) 100(1) 11
Dennis 100(1) 9(2) 100(1) 30(3) 7
Elin 95(2) 6(5) 70(4) 10(5) 16
Frank 75(6) 5(6) 50(6) 20(4) 22

BACKGROUND INFORMATION
Machine learning, a hot topic these days, is about training a machine using a large amount of data
with various characteristics. For example, suppose a machine learning model is trained using data with
characteristics such as area of a house, number of rooms, distance from next school, age of house,
distance from next shop, etc. to predict the price of a house. The units of each characteristic such as
area, age, and distance are different, and the range of price will be quite different.
In this case, normalisation, a process of converting values so that all features have a similar influence, is
required. Therefore, in machine learning, the normalisation process is important to ensure that all data
injected into a model are reflected at the same scale (importance).
In addition, for very large data, robustness is required meaning that the calculation is not affected by
outliers or input errors.

56
This question comes from Years 3+4
Slovakia Years 5+6
Years 7+8

Decorations
Years 9+10 Medium
Years 11+12

Lara and Michaela have decorated their Christmas tree using 18 unique ornaments. The ornaments all
have a shape (star, ball, bell), a size (small, medium, large) and sometimes a pattern.

Michaela has a favourite ornament and Lara has to figure out which one it is, by asking yes/no
questions about the shape, size, and pattern of the favourite ornament.
Lara needed exactly four yes/no-questions before she knew with certainty that Michaela likes the
medium sized star without a pattern the most.
Can you figure out which four questions Michaela asked?

Question
Drag the questions Lara may have asked next to the answers Michaela has given.
Note: there is more than one correct solution, you only have to provide one.

Continued on next page


57
This question comes from Years 3+4
Slovakia Years 5+6
Years 7+8

Decorations – continued
Years 9+10 Medium
Years 11+12

Answer
Here are four possible solutions:

Lara’s questions Lara’s questions Lara’s questions Lara’s questions Answers

Is it medium? Is it medium? Is it a star? Is it a star? Yes

Is it round? Is it a bell? Is it large? Is it small? No

Is it a star? Is it a star? Is it medium? Is it medium? Yes

(always as final question: ) Does it have a pattern? No

Explanation
Since there is only one way to ask about a pattern (‘Does it have a pattern?’) and the resulting favourite
ornament has no pattern, one of the questions Lara asked was ‘Does it have a pattern?’ and the answer
to it was no. We have three questions left.
To guess the shape or size, we need one question (if we guess correctly right away) or two questions (if
our first guess was wrong).
Let’s first consider the possibility that Lara guessed the shape correctly the first time. Thus she had to
ask ‘Is it a star?’ and she got the answer yes. Then she asked about the size twice, answering no for the
first time and yes for the second time. She could get a negative answer to either question ‘Is it large?’
or ‘Is it small?’. The positive answer was to the question ‘Is it medium?’.
Now let’s discuss the possibility that Lara guessed the size correctly the first time. Thus she had to ask
‘Is it medium?’. She then asked about the shape twice, getting the answer no for the first time and yes
for the second time. She could get a negative answer to either question ‘Is it round?’ or ‘Is it a bell?’ and
the positive answer to the question ‘Is it a star?’.
She had to ask the question ‘Does it have a pattern?’, to which the answer was no, at the end, because
one of the other questions needs no as an answer, followed by a yes, as shown above. If ‘Does it have
a pattern?’ was asked second, then Lara would know the ornament after 3 questions, and the 4th
question would be redundant. Since the question states that Lara needed four questions before being
able to determine with certainty what the favourite ornament was, this can’t have been the case.

BACKGROUND INFORMATION
This is an example of a classification (categorisation) task, a very importnat problem in infomatics. In
the classification task, we try to classify each object into a certain category based on its characteristic
properties. In our case, the ornaments according to size, shape or pattern. In addition, in this task, each
ornament has a different triple of characteristic properties, so we can uniquely identify each ornament.
Common classification problems in real life are classification of medical images, facial recognition, and
email spam detection.
The task is similar to games like ‘Guess Who?’ or ‘Twenty Questions’. The main principle of these games
is that by each question we divide the set of possibilities into two groups, one with no satisfactory
objects (which we can eliminate for the next turn) and the second one with potentially satisfactory
objects (which we consider in the next turn). If these two groups are always the same size, then the
process is analogous to the binary search algorithm.

58
This question comes from Years 3+4
Poland Years 5+6
Years 7+8

WhatDoesItDo
Years 9+10 Medium
Years 11+12

Beavers Gabe and Melissa are playing around with block code. They have figured out through trial and
error that takes the result of a division and rounds it down to a whole number, and that
takes the remainder. For example:

90 7 is 12, and

90 7 is 1.
Melissa has given Gabe the following function called WhatDoesItDo, which takes an integer M as input.
The function first checks the size of M before deciding what part of the program to follow. The function
continues until it reaches the end of the instructions.

Question
When M is 30241, what number will the function write?

Continued on next page


59
This question comes from Years 3+4
Poland Years 5+6
Years 7+8

WhatDoesItDo – continued
Years 9+10 Medium
Years 11+12

EXPLANATION

Answer
The correct answer is 30241.

Explanation
Since the function includes itself as part of it, the integer M is processed through the function over and
over again. The input is updated each pass through the function. This information and the respective
output that is written by the function is shown in the following table. The Function Level refers to
where that particular function is nested within previous functions. In other words, when 30241 is
initally passed through the function, it is at level 1, however this leads to 3024 being passed through
the function which is nested within the original pass. This new pass of the function is now level 2,
and so on.

Function Input p(m<10) m div 10 m mod 10 Output


Level
1 30241 False 3024 – –
2 3024 False 302 – –
3 302 False 30 – –
4 30 False 3 – –
5 3 True – – 3
4 30 – – 0 0
3 302 – – 2 2
2 3024 – – 4 4
1 30241 – – 1 1

BACKGROUND INFORMATION
When we repeatedly need to ask the computer to do the same set of tasks over and over again, we will
define this set of tasks as a function for easy reference in our program. This way, when we need to do
this set of tasks, we can call the function instead of writing out the set of instructions over and over
again.
Sometimes, when we define a function, we will refer to the function itself as part of the task which
the function should do. We call this technique recursion. Recursion is often difficult for us humans to
keep track of, but it is easy carried out by computers as at its core it is just following a well-defined
algorithm to completion.

60
This question comes from Years 3+4
New Zealand Years 5+6
Years 7+8

Ice Cream Machine


Years 9+10 Medium
Years 11+12

In Beavaria, the ice cream shop “Baskin Loggins” owns a special ice cream machine. It has two
ingredients that can be put into the machine to give the ice cream flavour: pistachio and vanilla.
These ingredients flow through the tubes from left to right, to where the ice cream comes out.
The machine is built up with the following devices:

This device changes the flavour – vanilla to pistachio, or pistachio


to vanilla.

If pistachio flavouring passes through this device, it will change


its direction to the tube it is pointing at. Any other flavour than
pistachio won’t change direction.

At this place, the tubes do not join but pass over each other.

Question
For today, “Baskin Loggins” can only pour one kind of ingredient into both inputs 1 and 2. Either they
pour vanilla into both inputs, or pistachio into both inputs.
Where do they have to place another device in the machine to get pistachio ice cream as the output
no matter which flavouring was used as the input?

A B A and B Neither A and B

Continued on next page


61
This question comes from Years 3+4
New Zealand Years 5+6
Years 7+8

Ice Cream Machine – cont’d


Years 9+10 Medium
Years 11+12

EXPLANATION
Answer
A and B.

Explanation
The correct answer is they have to place a device at both point A and point B. A single device changes
the flavour so two consecutive devices will change the flavour back to what was originally put in. Thus
to have pistachio ice cream after pouring in the pistachio flavouring, the flow must go through an even
number of devices:
• If they pour pistachio into input 1 and 2 to start with, both go through the left vertical route, and
a device has to be placed at A to ensure it has gone through 4 devices (an even number) so the
outcome is pistachio.
• If they pour vanilla into input 1 and 2 to start with, the ingredients will flow straight through the
direction changing device and along the horizontal path. If they want to get pistachio from the
machine, when vanilla has been poured in, there must be an odd number of devices, and this is
achieved by placing a device at B.

BACKGROUND INFORMATION
The scheme that needs to be completed in this problem can be viewed as a synchronising automaton,
which, regardless of the type of ice cream supplied to the input, always outputs pistachio ice cream.
It can also be viewed as a logic diagram. At the same time, one needs to pay attention to the fact
that the task uses a ternary logic - which differs from binary as there are three possible states - since
there may be vanilla ice cream in the pipe, pistachio ice cream, or the pipe may be empty. Accordingly,
the device for changing the taste is somewhat different from the logical NOT - it changes the taste of
ice cream varieties, but does nothing when there is nothing in the pipe: NOT (F) = T, NOT (T) = F,
NOT (U) = U.
The device shown with a green dot has one input and two outputs. Therefore, it can be represented as
the operation of two ternary logical devices, both of them will differ from the ternary NOT described
above. One of them (denote it P) will work like this: P (F) = U, P (T) = T, P (U) = U. The second device
R is as follows: R (F) = F, R (T) = U, R (U) = U. Computers can be built on ternary logic - in fact, while
modern computers function on binary, ternary computers were really built. In some aspects related to
information theory, such computers are better than binary computers.

62
This question comes from Years 3+4
Uruguay Years 5+6
Years 7+8

Secret Number
Years 9+10 Medium
Years 11+12

In Bebravia payments are made with special coins. Each coin has its own value written in the centre.

A citizen of Bebravia has the four coins shown above, but the value at the centre of one of the coins is
rubbed out. However, each coin’s value can be worked out using the same set of rules. From this, the
citizen was able to determine the missing value.

Question
What is the missing value?

22 23 26 29

EXPLANATION
Answer
29.

Explanation
The value of each coin is calculated as following: sum of the numbers surrounding the central coin
value plus the number of sides the coin has. In this task there are four different coins:
Square: 3 + 5 + 6 + 2 + 4 = 20
Hexagon: 1 + 9 + 2 + 4 + 5 + 0 + 6 = 27
Triangle: 10 + 2 + 3 + 3 = 18
Pentagon: 5 + 2 + 3 + 8 + 6 + 5 = 29
A student attempting this might at first try to find a relationship between the numbers around the
outside and the value in the middle and, after failing to find a simple pattern (and remembering that
Bebras tasks do not require any mathematical knowledge beyond simple numeracy) go back to the task
and check they have extracted all of the data given. Looking for more data should enable the student
to notice that the coins have different numbers of sides and then quickly work out the pattern.

BACKGROUND INFORMATION
The value of each coin is formed by two parts. It is important to figure out that the coin value (the
number in the centre) is obtained from the sum of numbers located on each side of the coin plus the
number of sides the coin has. All value calculations follow the same pattern.
Patterns and pattern recognition are used in engineering, computing, mathematics and are related to
physical or abstract objects. Pattern analysis can be simple or sophisticated. Patterns can be obtained
from the processes of segmentation, extraction of characteristics and description where each object is
represented by a collection of descriptors. The purpose of the analysis is to extract data that allow us
to recognise properties and mark regularities among sets of objects. In computer science, a software
design pattern is a common template solution that helps speed up the development of computer
programs.
63
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Ada’s Marble Machine


Years 9+10 Hard
Years 11+12

Ada the engineer is working with a set of marbles that have four properties, but only certain
combinations are permitted as shown below:

Size Colour Material Design Possible?

Small Red Stone Glitter No

Small Red Stone Mosaic No

Small Red Metal Glitter Yes

Small Red Metal Mosaic No

Small Yellow Stone Glitter Yes

Small Yellow Stone Mosaic Yes

Small Yellow Metal Glitter Yes

Small Yellow Metal Mosaic Yes

Large Red Stone Glitter No

Large Red Stone Mosaic No

Large Red Metal Glitter No

Large Red Metal Mosaic No

Large Yellow Stone Glitter No

Large Yellow Stone Mosaic Yes

Large Yellow Metal Glitter No

Large Yellow Metal Mosaic No

Ada also provides a flowchart that can correctly check whether the given marble belongs to the set
described by the table. Only one of the four flowcharts shown below was made by Ada.

Continued on next page


64
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Ada’s Marble Machine - cont’d


Years 9+10 Hard
Years 11+12

Question
Which of the following four flowcharts correctly checks for any given marble if it belongs to the set
described by the table?

Continued on next page


65
This question comes from Years 3+4
Australia Years 5+6
Years 7+8

Ada’s Marble Machine - cont’d


Years 9+10 Hard
Years 11+12

EXPLANATION
Answer

Explanation
• The first flowchart accepts the marble after “is it large? / no”. That means all small marbles are
accepted which is not correct.
• The second flowchart incorrectly identifies “large red stone mosaic” and “large yellow metal glitter”
as a valid combination. The flowchart successfully finds the valid “small yellow” combinations.
• The third flowchart correctly finds the valid combinations “small red metal glitter” and “large yellow
stone mosaic” but it fails to identify the valid “small yellow” combinations.
• The final flowchart correctly finds the valid “small red metal glitter”, “large yellow stone mosaic”
combinations and additionally the valid “small yellow” combinations.

BACKGROUND INFORMATION
Only a subset of possible combinations of properties were considered valid in the table from this
question. For those combinations, the term “well-formed” is used as opposed to “malformed” for the
incorrect ones. Flowcharts are a possible notation to formalise ‘well-formedness’ for a particular set
by describing the process of validating a given combination. In our example the set was very small,
and it was possible to show the list of valid elements, but for very large sets this is no longer possible
and formalised methods to check for validity are necessary. The flowchart could be incorporated in a
program to automatically run checks on large numbers of elements quickly.
The character in this question is named after Ada Lovelace, often referred to as the world’s first
computer programmer.

66
This question comes from Years 3+4
Saudi Arabia Years 5+6
Years 7+8

Smart Farm Robot


Years 9+10 Hard
Years 11+12

On Beaver Island, there is a carrot farm. The farm has 5 rows with 7 equally spaced carrots in each row,
as shown below. Last year, the beavers started using a robot to harvest the carrots. The robot follows
instructions using the following commands:
• P - Look for a carrot in the same row and pick it up.
• F - Go forward in the same row.
• D - Go down to the next row with a smaller number.
• U - Go up to the next row with a bigger number.
• R - Turn right 90°.
• L - Turn left 90°.

If the robot needs to repeat the instruction more than once, it can be represented as number before
the instruction. For example:
• 3F means the robot will move forward 3 spaces in the same row.
A set of instructions can also be repeated in this way using parenthises. For example:
• 3(F P) means the robot will repeat the instructions ‘move forward one space and then pick up a
carrot in that space’ three times.
The robot can only move in the direction it is facing - that means the robot can only follow an F
command if it is facing left or right along a row, and can only follow a D or U command if it is facing
down or up respectively.

Question
A single robot starts in the top-leftmost space (next to the green flag) and is facing towards the sign
with the number 5 on it. Which set of instructions will get the robot to harvest all carrots?

2(P6 (F P) R D R) (P 6(F P) L D L) 7P R 3(P 4(D P)L F L)(P 4(U P) R F R)

2(P 6(F P) R D R P 6(F P) L D L) P 6(F P) 5(7P D) 7P

Continued on next page

67
This question comes from Years 3+4
Saudi Arabia Years 5+6
Years 7+8

Smart Farm Robot – continued


Years 9+10 Hard
Years 11+12

EXPLANATION

Answer
2(P 6(F P) R D R P 6(F P) L D L) P 6(F P).

Explanation
Only the instruction 2(P 6(F P) R D R P 6(F P) L D L) P 6(F P) will allow the robot to harvest all the carrots.
To see that this set of commands is correct, they can be carried out fully as shown below.
1. To harvest all carrots at the farm, start with Row 5 and pick up the 7 carrots from left to right. We
write the instruction P 6(F P) - pick up the carrot in the starting plot, and then repeat the instruction
‘move forward one space and harvest the carrot’ six times. This will instruct the robot to pick all the
carrots in Row 5.
2. To go to Row 4, the robot should turn right 90°, then go down. And the robot has to turn right
another 90º before it can pick up carrots along Row 4. Therefore, we write the instruction R D R.
3. In Row 2, the instruction P 6(F P) makes the robot pick up all 7 carrots along the row, as in
instruction 1.
4. To go to Row 3, the robot should turn left 90°, then go down. In order to move along Row 3, the
robots has to turn left 90° again. We write the instruction L D L.
5. The previous 4 sets of instructions makes the robot pick up all the carrots along the rows. We can
repeat these instructions for the next two rows, namely Row 3 and Row 2. Therefore, we group the
previous instructions together with () and put the number 2 at the beginning, forming 2(P 6(F P) R D
R P 6(F P) L D L).
6. And last, the instruction P 6(F P) makes the robot pick up all the carrots in Row 1.
Therefore, the instruction should be: 2(P 6(F P) R D R P 6(F P) L D L) P 6(F P)
The other options are either incorrect (for example, asking the robot to move up, down, or forward
while facing the wrong direction), or does not harvest all the carrots.

BACKGROUND INFORMATION
Looping is a type of instruction used in all program languages to execute a sequence of statements
multiple times. The set of instructions will repeat a certain number of times or until it reaches the
specified condition. Loops are useful as it allows complex sets of instructions to simplified into
understandable representations. This allows programmers to find bugs in the code more easily, as well
to both communicate how the code works and to find points within the code that can be optimised.

68
This question comes from Years 3+4
the Philippines Years 5+6
Years 7+8

Unification
Years 9+10 Hard
Years 11+12

In ancient Beavaria, there lived four tribes consisting of several villages. Each tribe had their own flag
as shown in the picture below.
One day, the tribes decided to unify. However, in order to not cause chaos, it was decided that only
two tribes can be unifying at the same time.
The time needed to unify two tribes, in months, is equal to the total number of villages in these
two tribes.
After this, the two tribes become one single tribe, and the unification process is repeated until there
is only one unified tribe remaining.

Question
What is the minimal amount of months needed for the tribes to unify?

23 24 25 26 27

EXPLANATION

Answer
24.

Explanation
The optimal strategy to minimise the total number of months needed to unify all the tribes is to
minimise the number of times each village is included in the unification processes. This can be done by
merging the largest tribes last, as the largest tribes with the greatest number of villages will then only
be added the least amount of times. In order to do this, each unification step should happen between
the two tribes with the fewest villages.

Continued on next page


69
Years 3+4
This question comes from
Years 5+6
the Philippines
Years 7+8

Unification – continued
Years 9+10 Hard
Years 11+12

This is illustrated in the table below:

1. Green triangles have the 2. The tribes that now have 3. Lastly, 5 blue triangles and
least number of villages, the least number of villages circles and 7 orange stripes
so they will be chosen for are orange squares (4) and squares villages unite
unification first. Since there and red stripes (3). After into one large orange shapes
are two tribes that have 3 unification we can call them tribe.
villages, we can choose to orange stripes and squares.
unite either one, for example,
green triangles and blue
circles. After unification they
can be called blue triangles
and circles.

This takes 5 months and results This takes 7 months and results This takes 12 months.
in 3 red stripes, 4 orange in 5 blue triangles and circles,
squares, and 5 blue triangles and and 7 orange stripes and
circles villages. squares.

Therefore, the minimum number of months to unify all four tribes from the land of Beavaria
is 5+7+12=24.

BACKGROUND INFORMATION
This challenge is an example of an optimisation problem, a task whose goal is to come up with a
strategy that maximises or minimises a certain quantity, subject to some constraints. Optimisation
problems are ubiquitous in our everyday lives: finding the shortest route to a destination, creating
a schedule that accommodates the most number of non-overlapping activities, and so on. There are
several ways to approach solving an optimisation problem, and these include greedy algorithms.
Greedy algorithms rest on the assumption that making the best choice at each stage (local optimum)
will result in the best final outcome (global optimum). In this problem, this assumption is satisfied:
tribes have to minimise the number of months for each unification in order to minimise the number
of months for the entire unification process.
It must be emphasised, however, that the greedy paradigm is not a universal solution to all types
of optimisation problems. Nevertheless, it usually provides a decent approximation within a
reasonable time.

70
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot


Years 9+10 Hard
Years 11+12

A robot starts from the position shown below and moves along the lines. There are three symbols
and on the lines that decide the direction it should take at the next intersection. The robot

must not reach the .

Each symbol has a different meaning and could mean:

turn left at the next intersection, or

turn right at the next intersection, or

go straight at the next intersection

Unfortunately, we do not know which symbol means what.


The meaning of the symbol remains the same regardless of the direction the robot is moving.
For example, the arrow in the picture below shows how the robot would turn, coming from either
direction, if a triangle symbol meant “turn left”.

71
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot – cont’d


Years 9+10 Hard
Years 11+12

Question
Help the robot reach by assigning correct meaning to the symbols.

EXPLANATION

Answer Explanation
The picture shows robot’s walk:

72
This question comes from Years 3+4
Czechia Years 5+6
Years 7+8

Symbol Reading Robot – cont’d


Years 9+10 Hard
Years 11+12

We can use different strategies to solve the problems. One of them is going through every possibility.
In this task there are only 6 different ways to interpret the symbols (the pictures show all of them) and
only one of them leads to :

Another strategy is to trace the path the robot could take and assign meaning to symbols as we follow
the path. If the robot reaches the red flag or enters a loop, or the meanings cannot be applied to
symbols consistently, we retrace to the previous step (in this case intersection) and try another path.

BACKGROUND INFORMATION
The first strategy proposed in the explanation is called brute force. This means to consider and check
every possibility until one finds the desired result. Sometime there can be many possibilities and
considering all of them could be very time consuming and therefore one need to find other strategies.
The second strategy is called backtracking. In this technique one incrementally builds candidates to the
solutions, and abandons a candidate as soon as one determines that the candidate cannot possibly be
completed to a valid solution. The advantage of backtracking with respect to brute force is that you do
not have to reconsider the new candidate solutions from the beginning, since you go back only to the
step where you made your last choice and continue on from there.
For the given problem brute force may work better, as we have few variables (symbols) and few paths
for the robot to take. However in general for larger complex problems, when the number of variables
increase and the paths to explore are more, backtracking provides better and elegant solution. Puzzles
like Sudoku can be elegantly solved using backtracking.
73
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Quiz Night
Years 9+10 Hard
Years 11+12

Eight people usually form three quiz teams:

The teams are organised so that each player knows all of the other players on their team. They also
know some of the players on the other teams. Who knows who can be represented by a graph.
In the graphs below, circles represent people. If there is a line between two people this means that
they do not know each other and so cannot be on the same team. The graphs can be helpful when
assigning teams by colouring in the circles, for example:

Unfortunately, one of the tables is broken tonight, so only two quiz teams can be formed.
At the moment, two teams cannot be formed unless two people are introduced to each other.
This introduction can be shown by removing a line on the graph. But who should be introduced?

Question
Select one line from the graph below that, when removed, allows two teams of four to be formed.

74
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Quiz Night – continued


Years 9+10 Hard
Years 11+12

EXPLANATION
Answer Explanation
Introducing two people means deleting an edge. We need
to delete an edge so that two colours are enough to colour
all the vertices (people) but no two vertices of the same
colour are connected by an edge.
The only possible option is the edge marked in orange
below.

After deleting this edge, we can colour the graph with two
colours as shown below right.

To test that deleting this edge is the only possible choice,


we need to consider both the triangle in the upper right
and the pentagon on the bottom.
First consider the triangle in the upper right:

If any edge outside of this triangle is deleted, we still need


three colours just for the three vertices of that triangle. So
one of these three edges needs to be deleted.

75
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Quiz Night – continued


Years 9+10 Hard
Years 11+12

Now consider the pentagon on the bottom:

If any edge outside of this pentagon is deleted, then it is impossible to colour all five of its vertices with
only two colours. To test this, we can cycle clockwise through the five vertices, alternating colours for
each one. But when we reach the last vertex, it will have the same colour as the first vertex because the
number of vertices in the cycle is odd.
Therefore we need to delete an edge that destroys both the triangle in the upper right and the
pentagon on the bottom at the same time. There is only one edge that is shared by both shapes,
leading us to the only possible answer.

BACKGROUND INFORMATION
Many real-world problems can be reframed as coloured vertices on a graph. An example is a graph
where the vertices are students and an edge between two students shows that they can’t be placed in
the same group. If we colour the vertices with k colours, this can be seen as assigning every student
to one of k groups. Such a colouring is proper if any two vertices directly connected by an edge have
different colours. Often, we just say colouring when we mean a proper colouring. An edge is sometimes
called critical if deleting it makes a proper colouring with fewer colours possible. In the example, this
means that if the corresponding two students are introduced and can then work together, then having
fewer groups becomes possible.

76
Bebras Challenge
2022 Round 2

Years 11+12
This question comes from Years 3+4
South Korea Years 5+6
Years 7+8

Taking Leaves
Years 9+10
Years 11+12 Easy

Beavers Miley and Jin take turns playing a game of “taking leaves”. As shown in the picture below,
leaves are piled on two plates A and B. When it is a beaver’s turn, they must take 1 or more leaves from
any one plate. The winner of this game is the beaver who takes the last leaf.

- 2 leaves - 3 leaves

Question
Choose the starting move where Miley can win regardless of what her opponent does.

Miley starts by taking 2 leaves from Jin starts by taking 1 leaf from

Miley starts by taking 2 leaves from Jin starts by taking 1 leaf from

EXPLANATION
Answer
Jin starts by taking 1 leaf from

Explanation
Miley and Jin will try to take the last leaf to win the game. In order for Miley to take the last leaf, one
plate has to be empty already. This can happen only if Jin takes the last leaf from any one plate right
before Miley. Therefore, Miley has to play in such a way that Jin would be forced to take the last leaf
from one of the plates.
Of the four situations presented in this task,
1. If Miley first takes 2 leaves of plate , Jin can win the game by taking all the 3 leaves from .
2. If Miley first takes 2 leaves from , Jin can take one leaf from thus forcing Miley to take the
last leaf from one of the plates and Jin wins.
3. If Jin starts by taking one leaf from , Miley can respond by taking two leaves from and leaving
Jin forced to take the last leaf from one of the plates. Miley then empties the remaining plate and
wins.
4. If Jin starts by taking one leaf from , Miley has to take one leaf from one of the plates. Then Jin
takes one leaf from the other plate. In this way Miley has to take the last leaf from one of the plates
and loses the game. We can also see, that this starting move by Jin is the best move for the player
starting the game.

So, the correct answer is 3.

Continued on next page


78
This question comes from Years 3+4
South Korea Years 5+6
Years 7+8

Taking Leaves – continued


Years 9+10
Years 11+12 Easy

BACKGROUND INFORMATION
This task is a variation of the famous Nim game, one of the first-ever computerized games. The
computer that was designed for this game in 1940, called Nimatron, is considered the first gaming
computer in the history of computing. This is one of the games, like tic-tac-toe, where it is impossible
to lose if you know the winning strategy.
It can be challenging to arrive at a winning strategy in games like this by considering all possible
cases, especially if the situation is more complicated and involves more plates and leaves. To reduce
the complexity of this (and other similar problems) it can be useful to solve the more simple cases
first and then reuse the answers later in more and more complicated cases, until you arrive at the
answer. In computer science this solving strategy where we reuse answers of sub-problems to solve
the main problem is called dynamic programming. Programmers often use dynamic programming to
substantially increase the effectiveness and reduce the running time of their programs. In this task we
also use a similar idea by recognizing what situations lead to winning or losing. If we later arrive at
these situations, we don’t have to repeat the same steps.

79
This question comes from Years 3+4
Pakistan Years 5+6
Years 7+8

Shop Counters
Years 9+10
Years 11+12 Easy

A shop has four billing counters numbered 1, 2, 3, 4. Each counter can have a queue of at most 4
customers, including the customer being served. Each counter can serve one customer at a time.
It takes 2 minutes to serve a customer.

When a customer wants to pay, they join the end of the queue at the first counter where the queue is
not full. They try the counters in ascending order - first counter 1, then counter 2, etc.
If there is no space available at any of the counters currently open, a new counter opens and the
customer joins the queue there. However, it takes 1 minute to set up a counter, so it takes 3 minutes to
serve the first customer at a newly opened counter. Each following customer will be served in 2 minutes
as usual.
At any given time, if there are customers who leave their queue after being served at the same time
that there are new customers who want to join a queue, you can assume that the served customers
leave first and create an empty space in their queues where new customers can join.

Question
Just after the store opens, the queues empty and only counter 1 is open. 12 customers arrive at the
queues, two at a time each minute (two customers arrive initially, another two after 1 minute, etc.).
How long does it take to serve them all?

12 minutes 11 minutes 13 minutes 8 minutes

EXPLANATION
Answer
The correct answer is 13 minutes.

Continued on next page


80
This question comes from Years 3+4
Pakistan Years 5+6
Years 7+8

Shop Counters – continued


Years 9+10
Years 11+12 Easy

Explanation
In the following picture the time (in minutes) are listed for when each customer (numbered in the
middle, white) arrives at the counter (in green, top) and when they leave (in red, bottom):

The leaving times in each counter queue is predictable, as each customer leaves 2 minutes after the
previous one. Th leaving times for each customer (shown in red, bottom) need to be tracked in order to
solve the problem, which can be computed for each customer when they arrive.
After 2 minutes, when 2 new customers arrive, customer 1 can be removed from counter 1 (as they
have finished being served) and one new customer joins the back of the queue at counter 1. This new
customer will finish being served 2 minutes after the customer in front of them in the queue (8+2=10),
while the other new customer goes to a newly opened counter (counter 2) and will be served 3 minutes
after the current time (2+3=5).
After 5 minutes, the queues will consist of the customers highlighted in yellow. However, the timer
continues until the last customer is served, which will be the last customer from the second queue, at
13 minutes. Thus, the correct answer is 13 minutes.
For some of the other options, 12 minutes is the time the last customer finishes in the first queue, while
8 minutes is the time the last customer finishes in the third queue.

BACKGROUND INFORMATION
Cloud services such as Google Cloud, Amazon Web Services, Microsoft Azure, etc., scale up the
availability of computing resources dynamically, based on the usage requirements of customers. This
way, customers only pay for the resources that they need. This flexible allocation of resources is called
dynamic scaling.
This task illustrates a simple example of dynamic scaling. Here the resources are billing counters.
Keeping a billing counter open requires paying one more staff member, for instance, so counters are
opened on demand as the number of customers grows. This keeps down the cost when demand is low.
In practice, dynamic scaling also involves scaling down when demand decreases. In the context of this
task, this would mean a strategy for closing counters when the number of customers starts to decrease.

81
This question comes from Years 3+4
Spain Years 5+6
Years 7+8

Sorting Beavers
Years 9+10
Years 11+12 Easy

A class in Beavaria High School has seven beavers in it. Each beaver is given a flag with a number on
it. They are seated in a row behind one another. In the beginning, the beavers are sitting randomly as
shown in the picture.
The class’s teacher wants to sort the beavers into ascending order, from number 1 at the front to
number 7 at the back. They can only be sorted using swapping operations, where in each swap exactly
two beavers exchange places. For example, when beavers 3 and 1 swap it means that beaver 3 goes to
1’s place and 1 goes to 3’s place.

Question
Given how the beavers are currently sitting, what is the minimum number of swaps needed to obtain
the desired order?

3 swaps 4 swaps 5 swaps 6 swaps

EXPLANATION
Answer
5 swaps.

Explanation
The correct answer is 5 swaps, since we have to swap two different beavers 5 times as shown below.
This problem can be solved using a selection sort algorithm. This algorithm divides the input list into
two parts: the sublist of items already sorted, which is built up from left to right at the front (leftmost
part) of the list, and the sublist of items remaining to be sorted that occupy the rest of the list. Initially,
the sorted sublist is empty and the unsorted sublist is the entire input list. The algorithm proceeds
by finding the smallest (or largest, depending on sorting order) element in the unsorted sublist,
exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving
the sublist boundaries one element to the right.

82
This question comes from Years 3+4
Spain Years 5+6
Years 7+8

Sorting Beavers - continued


Years 9+10
Years 11+12 Easy

With the first order (the order seen in the body of the task), the lowest unsorted number (the number
1) is swapped with the number of the first place of the list (the number 2). In the next step, starting
from the second place of the list, the lowest unsorted number (that is, the number 2) is swapped with
the number of the second place of the list (the number 3). Following this algorithm, 5 steps are needed
as shown below:

Given that only direct swaps can be made to sort the beavers,
5 swaps is the minimum number of swaps needed to have the
beavers sitting in the number order of their flags.

BACKGROUND INFORMATION
Sorting algorithms allow us, as their name says, to sort information
in a special way based on a sorting criterion. In computer science,
data sorting plays a very important role, either as an end in itself or as
part of other more complex procedures. Many techniques have been
developed in this field, each with specific characteristics, and with
advantages and disadvantages over the others.
The selection sort algorithm improves on the bubble sort algorithm
by making a single swap for each pass through the list. In order to
do this, a selection sort looks for the lowest value as it makes a pass
and, after completing the pass, puts it in the correct location. As with
bubble sorting, after the first pass, the lowest item is in the correct
location. After the second pass, the next lower is in place. This process
continues and requires, in general, n-1 passes to sort the n items, as
the final item must be in place after the (n-1)-th pass.
Due to the reduction in the number of trades, selection sort usually
runs faster than bubble sorting, although for other sorting problems,
it may not be the faster algorithm (there are a lot of algorithms for
sorting “things”).
If we compare selection sort with the bubble sorting, we can see that
the selection sort (detailed in the answer explanation) is faster.

83
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Fruit Stack
Years 9+10
Years 11+12 Easy

A family of four prepares breakfast for the next day. They pile up four boxes, each filled with a
different fruit:

apple , pear , orange , or strawberry .


As they are sleepy in the morning, they all just grab the box off the top of the pile. They do not know
in which exact order they will get to the pile of boxes, but the mother always gets there before the
daughter, and the father is always last.
Each of the four like and dislike different fruits. Fruits they like are marked below with a tick and fruits
they dislike are marked with a cross:

Father

Mother

Daughter

Son

Question
Drag the fruits into the boxes so that everyone is guaranteed to get a fruit they like.

Continued on next page


84
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Fruit Stack - continued


Years 9+10
Years 11+12 Easy

EXPLANATION

Answer
There is only one correct solution:

Explanation
We first look at what the father wants. He only likes oranges and will be the last one to reach the
boxes. Therefore, we need to put oranges into the box at the bottom so he is guaranteed to get a fruit
he likes.
Because we know that the mother will be taking her box before the daughter gets up, the mother is
either the first or the second one to take a box.
For the same reason, the daughter is the second or third one to take a box. The son can be first,
second, or third.
To summarize, the following three arrival orders are possible:

1st Mother Mother Son

2nd Son Daughter Mother

3rd Daughter Son Daughter

4th Father Father Father

We see that the second one to get up can be either the son, daughter, or mother. This means that the
fruit in the second box from top must me something that they all like.

Continued on next page


85
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Fruit Stack - continued


Years 9+10
Years 11+12 Easy

Looking at the table of options, the only option that all three enjoy is the apple. (Second row in the
table below.)
So we are left with two choices for the topmost box - pear and strawberry. This box can be taken by
either the mother or the son. The mother does not like pear. Therefore we have to put strawberry into
the first box, which the son also likes. (First row in the table below.)
We can now put pear into the third box, which both the son and daughter like. (Third row in the table
below.)
In summary, we have the following options for the order of the family members arriving, which gives
us the order of fruits shown below.

1st Mother or Son

2nd Daughter or son or mother

3rd Daughter or son

4th Father

BACKGROUND INFORMATION
One of the first things computer scientists learn is the importance of having everything correctly
sequenced and the need to understand the background information of the problem. Without knowing
exactly who will eat first, we need to organise the data to make the problem solvable. The actual order
used in this task is stack order, in particular “Last in, First out” or LIFO. The pile of boxes in the fridge is
what computer scientists would call a stack: a structure where only the item on top of the stack can be
accessed. Only after removing the top item does another one becomes available. Stacks are used very
frequently in programming.
The task asks to find a way of sorting of the fruits which will work under multiple possible conditions.
But there are some constraints, and not all possible orders of family members can occur. Solving such
constraint problems can be very difficult. Often the best idea to do so is writing and using a computer
program to solve the problem.
Logic is important in computer science and computer programming, which is why problems that help
students understand logic lay a good foundation for when they start creating computer programs.
Creating tables to display all possibilities (as shown in the explanation) is a good way to sort and
sequence the given data. The use of Boolean logic may also be useful by using AND, OR and NOT to
determine which data is useful in any given sequence. Students will start to understand conditionals
in programming too, such as ELSEIF, by solving computational problems like the one shown in this
question.
Once students have a good understanding of logic and how problems can be dealt with by following
and sequencing commands logically, they will be better placed to write their own computer programs
to solve problems with many variables. They will then be able to write programs to help deal
with stacks.

86
This question comes from Years 3+4
Ukraine Years 5+6
Years 7+8

Longest Sequence
Years 9+10
Years 11+12 Easy

Beaver Ali is making jewellery using beads of four unique colours. Ali makes a chain by randomly
selecting and lining up 16 beads in a row. However, Ali prefers long unbroken sequences of identical
beads, so they allow themself to change the colour of at most 3 beads in the chain.
Ali pulls out the following 16 beads and lines them up randomly as shown:

Question
What is the length of the longest possible unbroken sequence of identical beads that Ali can make for
this chain?

4 5 6 7

EXPLANATION
Answer
The correct answer is 6. To show this, we need to prove two things:
1. That an unbroken chain of length 6 is possible, and
2. that an unbroken chain of length greater than 6 is not possible.
The first part is easy to prove. Here is how an unbroken chain of 6 stars can be made:

To prove that an unbroken chain of length greater than 6 is not possible, consider any chain of length 7.
Since we are only allowed to change three shapes, any chain of length 7 in the original sequence must
already have four identical shapes in it.
There are ten chains of length 7 in the original sequence, a few of which are shown below. In no chain
can four identical shapes be found.

Since it is not possible to have an unbroken chain of length 7, it is certainly not possible to have an
unbroken chain of length greater than 7.
Thus, we have shown that the length of the longest unbroken chain of identical shapes possible is 6.
Continued on next page
87
This question comes from Years 3+4
Ukraine Years 5+6
Years 7+8

Longest Sequence – continued


Years 9+10
Years 11+12 Easy

BACKGROUND INFORMATION
This task is related to finding a longest substring that matches some given criteria. There are many
instances in informatics where finding a longest substring is useful, in particular, finding a longest
common substring given two strings.
Finding the longest common substring can help detect plagiarism, and help compress data by data
deduplication (removing redundant copies of data). Some techniques that can be used to find longest
sequences include the two pointer method, and the sliding window.

88
This question comes from Years 3+4
Taiwan Years 5+6
Years 7+8

Grocery Shopping
Years 9+10
Years 11+12 Medium

Below is the map of the village where the Beaver family lives. To go from one building to another,
Beavers walk along either a muddy path 2021-TW-05_mud or a rocky path 2021-TW-05_rock.
Walking between two buildings takes Little Beaver 5 minutes by muddy path 2021-TW-05_mud and 8
minutes by rocky path 2021-TW-05_rock. For example, it takes Little Beaver 5 minutes to go from the
plaza to either the flower shop or to the bookstore, and 8 minutes to go home from either the seafood
shop or the meat shop.
Starting from the Beaver’s home at the bottom of the map and moving clockwise, the shops in the
village are the bookshop, the meat shop, the supermarket, the fish shop, and the flowershop.

Mother Beaver asks Little Beaver to help with grocery shopping. The shopping list is shown above.
Little Beaver has to start the trip from home, finish all the shopping, and come back home. Also, in
order to keep the fish fresh, Little Beaver has to visit the seafood shop right before going home.

Question
What is the minimum walking time Little Beaver needs?

EXPLANATION

Answer
The correct answer is 33.

Continued on next page


89
This question comes from Years 3+4
Taiwan Years 5+6
Years 7+8

Grocery Shopping – cont’d


Years 9+10
Years 11+12 Medium

Explanation
The original task can be broken down into two ordered sub-tasks: (1) finish shopping at three shops,
(2) buy fish and go home. The least walking time needed for each sub-task is shown below:

(1) shopping at 3 shops (2) buy fish and go home Total time (mins)
Route Minimum time Route Minimum time
(mins) (mins)
home-meat- 28 market-seafood- 13 41
flower-market home
home-meat- 23 flower-seafood- 13 36
market-flower home
home-flower- 20 meat-seafood- 16 36
market-meat home
home-flower- 20 market-seafood- 13 33
meat-market home
home-market- 25 flower-seafood- 13 38
meat-flower home
home-market- 30 meat-seafood- 16 46
flower-meat home

By breaking down the task, every possible route to complete each sub-task can be explored.
By calculating the minimum time needed to complete each sub-task, it is possible to then get the
minimum time needed to finish the whole task. Based on the table above, the minimum walking time
Little Beaver needs to finish shopping and also buy fish last before going home is 33 minutes. The route
Little Beaver should take is shown below.

BACKGROUND INFORMATION
In this task, we can find the shortest route by drawing it out. However, in real life, when there are
thousands of paths to choose from instead of 15, we will need help from technology, such as GPS and
routing software, to find the shortest path.
In computer science, graphs are a common way to show relationships between data. Graphs can be
used to represent links between objects. It is a method of representing the connections between things
with vertices and edges. Graphs also make it easier to describe the relationships (often represented by
edges) amongst key points (often represented by vertices) of complex concepts.
In graph theory, the shortest path problem aims to find a path (edge) with the shortest distance
between two things (vertices) in a graph. Sometimes, the paths have different weights, so the distance
between two things has to be multiplied by the weights. In this case, the shortest path problem is
solved by finding the minimized weighted distance.
90
This question comes from Years 3+4
Slovenia Years 5+6
Years 7+8

Jumping Jack
Years 9+10
Years 11+12 Medium

Jack the monkey lives in a park. He can jump from one tree
to another if it is either up to two cells away horizontally or
vertically, or one cell away diagonally, as shown in the diagram
on the right.
Jack plays a game in which he jumps to as many different trees as
possible without touching the ground. He can start from any tree
in the park.
In the map below you can click on a tree to change it from one
type to another.

Question
Find the biggest number of trees Jack can visit in one go without
touching the ground and change them to orange square trees.

Continued on next page


91
This question comes from Years 3+4
Slovenia Years 5+6
Years 7+8

Jumping Jack – continued


Years 9+10
Years 11+12 Medium

EXPLANATION

Answer
In the diagram below, the groups of trees that
Jack can visit without touching the ground have
been coloured in different colours.

There are six groups of trees in the park. If Jack starts on a tree coloured in yellow, he can reach all
the yellow trees, and no trees of other colours. How do we find such groups? Pick a random tree and
colour it in a certain colour. Then use the same colour for all trees that are reachable from it. And all
trees that are reachable from those trees, too. And so on, until you cannot reach any other trees. If
there are any trees that haven’t been coloured yet, take another colour and start again from a random
uncoloured tree. This colouring simulates Jack exploring.
The largest group of trees is the dark blue one, which contains 8 trees. The dark blue cluster is the
correct answer.

BACKGROUND INFORMATION
From the point of view of computer science, this question involves manipulating a graph: the trees are
called vertices, and two trees are connected with an edge when Jack can jump between them. In the
diagram below, the edges are as purple lines between trees.
If there is a path using these edges that allows Jack to go from
one tree to another, then these two trees belong to the same
group. These groups are called the connected components of
the graph. Here a different colour is used to represent each
connected component.
The procedure for colouring is similar to a number of different
graph algorithms that deal with searching: breadth-first search
and depth-first search.

92
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Counting by Nodding
Years 9+10
Years 11+12 Medium

A ticket vending machine uses computer vision (CV) for communication. To purchase n tickets, the
customer standing in front of the vending machine must nod n times and then raise their head once.
The CV system constantly detects the vertical length of the bridge of the nose in the live camera image
and assigns it to the variable nose.

If the value of nose is 1, the head


is in its normal position.

When the customer nods and the


head goes down, the value of nose
gets greater than 1, because the nose
appears to be longer.

When the head is raised, the value


of nose gets lower than 1.

The control program is started when a customer stands in front of the vending machine and the head is
in its normal position.

Question
A skeleton of the control program is shown below.
Complete the program by dragging the appropriate condition blocks from the right to the gaps in the
program.

Continued on next page


93
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Counting by Nodding – cont’d


Years 9+10
Years 11+12 Medium

EXPLANATION
Answer

Explanation
The program uses two variables named count and nose. The variable count contains the number of
nods, and nose represents the visible nose bridge (see task) and is automatically updated by the CV
system.
A sequence of three commands is repeated in a loop until the head is raised and therefore nose gets
a value smaller than 0.8. These repeated commands manage the counting: First the system waits until
the head goes down (nose > 1.2) and then waits until it goes up again (nose < 1.1). This is one complete
nod. The value of the variable count is increased by 1.
When the loop is finished (because the person has raised their head such that nose < 0.8), the variable
count contains the number of nods and count tickets are delivered.
The program has to use inequalities, as in real life applications, it will be difficult for the user to get
the exact value of nose = 1 to signify the end of each nod. Similarly, the values used to trigger an action
should be significant enough that it can be considered a deliberate action of the user. For example, if
nose > 1 is used to measure a nod, minuscule head movements can be counted as one nod even though
it is not the intention of the user.

BACKGROUND INFORMATION
Computer vision (CV) makes it possible to communicate with a machine by gestures. An e-book reader
with a clever CV control system enables a person who cannot use thier hands to turn pages by head
movements. For programming languages there exist special program libraries like OpenCV supporting
CV. These libraries contain special commands that make it possible to detect parts of a face like the
eyes or the bridge of the nose in a camera image.
In the task, the program shown is described as a “skeleton of the control program” because it is not a
finished program. It will need further real life testing to check that the variables chosen work in a good
variety of situations, that it produces reliable data in a high percentage of occassions, and that there
are no bugs that lead to the vending machine behaving in unexpected ways.

94
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Playing with Hats


Years 9+10
Years 11+12 Medium

A beaver likes to play a game by placing circular pebbles on square paving stones.
The beaver moves from left to right, one square at a time .
The beaver has a hat and behaves differently depending on whether they have the hat in their hand or
on their head.
The rules that the beaver follows are listed below: :
• If the beaver has the hat in their hand and steps on a square with no pebble, they continue on with
no change.
• If the beaver has the hat in their hand and steps on a square with a pebble, they take the pebble and
put the hat on their head before moving to the next square.
• If the beaver has the hat on their head and steps on a square with no pebble, they place a pebble on
the square and take the hat off before moving to the next square.
• If the beaver has the hat on their head and steps on a square with a pebble, they continue to the next
square with no change.
The pictures in the table below show the rules of the game. The changes for each situation are shown
“before after”.

Rules:

At the beginning, the beaver has the hat in their hand and three pebbles are on the squares in the
positions shown below.

Question
Show which squares have pebbles on them after the beaver has moved over all of them and left the
last square.

Continued on next page


95
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Playing with Hats - continued


Years 9+10
Years 11+12 Medium

EXPLANATION
Answer

Explanation
The solution can be found by step-by-step analysis. We show this in this picture, using the rules below:

BACKGROUND INFORMATION
The beaver has two states:
• hat in hand
• hat on head
Depending on its state, the beaver behaves differently. The beaver with its rules behaves like a Turing
machine. A Turing machine is a useful model for computation in computer science. Although it is
very simple, it is as powerful and as efficient as any programming language. This means any software
program can be converted into a Turing machine and, conversely, any Turing machine into a program.
It was first described in 1936 by the English mathematician and computer scientist Alan Turing. Turing
machines are one of the most important formal models in computer science.
• A Turing machine has various necessary components:
• A long tape divided into squares. Normally it is said to be infinite.
• A finite alphabet of symbols, e.g., 0, 1. In our example we used a pebble and no pebble.
• A read/write head: this would be able to look at a square and read its symbol. After reading and
proceeding according to the rules the head would then move left or right one square at a time.
In our case the beaver represents the read/write head.
• A finite set of states: we used two states: hat in hand and hat on head.
• A set of rules (transition rules): to specify how the machine operates (see task description).

96
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Compact Representation
Years 9+10
Years 11+12 Medium

Beaver Xavier wants to be able to send secret messages to his friends, so he creates a code to represent
some letters with binary digits 1 and 0. He notices that letters T and E are more frequent, thus he
decides to give them a shorter representation and thus code the letters T, E, A, K, C, and R as follows:

Letter T E A K C R
Code 1 00 0010 0110 1010 1110

Xavier sent this coded message to Yvonne:

Question
In letters, what is the complete message written by Xavier?

EXPLANATION
Answer
The correct solution is: TAKECARE.

Explanation
Here is the correspondence between characters and their binary representation in Xavier’s message:

Letter T A K E C A R E
Code 1 0010 0110 00 1010 0010 1110 00

To reconstruct the message, Yvonne must find a way to segment the whole message into a sequence of
letter. This is not so easy to do starting from the left as multiple options for decoding quickly appear.
For example, starting from the leftmost digit – Yvonne can quickly identify that the first letter is T and
corresponds to a “1”. This is because there are no letters that correspond to the sequences “10”, “100”,
or “1001”.
The second letter is a problem: it could either be E, represented by “00”, or A, represented by “0010”.
At this stage, Yvonne can’t know for sure. The message Xavier sent is unambiguous, though: when
decoding, if Yvonne made the wrong choice at the second position and choose E, she will be stuck later
on and realise that guessing E was incorrect – therefore the only possibility was A.

Continued on next page


97
This question comes from Years 3+4
Switzerland Years 5+6
Years 7+8

Compact Representation – cont’d


Years 9+10
Years 11+12 Medium

However, Yvonne never has to “make a guess” when decoding a letter if she starts from the last
digit in the sequence. This is because the code is suffix-free: there is no code word which ends in a
sequence of 1s and 0s that would itself be another code word. Thus, one can easily reconstruct the text
unambiguously by reading the binary code from right to left. When a code of a letter has been found,
one can exchange the code for the letter.
The diagram below illustrates how the binary message can be read from right to left, yielding letters
unambiguously:

Had Xavier wanted it to be possible for someone to decode this message unambiguously at all stages
from left to right, this would have required a prefix-free code, i.e., a code where no code word begins
with a sequence of 1s and 0s that is itself another code word. Xavier’s code is not prefix-free, as the
code word “0010” for A begins with “00”, which is itself the code for E.

BACKGROUND INFORMATION
All objects a computer is working with must be described as sequences of bits. This is also true for
texts. One always expects that the original object can be reconstructed from its binary representation,
but this is only possible if it never happens that two or more different objects have the same binary
representation. Computer scientists are asked to develop such systems of codes that one can efficiently
reconstruct the original object (for instance, a text) from its binary representation.
If one wants to compress a text (to get a binary representation of the text that is as short as possible),
then a good strategy is to take shorter binary codes for the more frequent letters and use longer
codes for the letters that are rare. One has to take care in this case to choose codes that guarantee
an unambiguous decoding (reconstruction of the original text) efficiently. Very good choices
for this purpose are prefix-free codes and suffix-free codes, whose principles are described in the
answer explanation.

98
This question comes from Years 3+4
Russia Years 5+6
Years 7+8

Save the Trees


Years 9+10
Years 11+12 Hard

On Planet Bebras there are many beautiful trees but no places for spaceships to land. A developer
wants to cut down trees in order to build spaceship landing zones. A ranger wants to save the trees.
They come to the following agreement:
• The ranger is allowed to mark 3 trees, which cannot be cut down, and
• A tree can only be cut down if needed to build a landing zone. That is, a tree cannot be cut down for
no reason.
The trees are arranged in a 5-by-5 grid. Spaceships are rather large and they require the space occupied
by 2 adjacent trees in order to land. The trees can be horizontally or vertically adjacent, but not
diagonally.

and illustrate the two valid ways a


spaceship could land.

Question
Assuming the ranger marks three trees wisely in order to save the most trees, and assuming the
developer cuts down trees wisely in order to build the most landing zones, how many landing zones
will be built?

11 10 9 8

EXPLANATION

Answer
The correct answer is 9.

Explanation
Because a spaceship always requires two
adjacent squares to land, the grid of trees
can be thought of as a chess board:

Continued on next page


99
This question comes from Years 3+4
Russia Years 5+6
Years 7+8

Save the Trees – cont’d


Years 9+10
Years 11+12 Hard

Thinking of the grid this way, a spaceship always takes up one black square and one white square. In
the grid there are exactly 13 white squares and 12 black squares, allowing a maximum of 12 spaceships
to land. If the rangers marked one tree on a white square, that would bring the total of white and black
squares to 12 and 12, still allowing a maximum of 12 spaceships to land. From this it follows that the
ranger should only mark trees on black squares. If the ranger marks three black squares, they can block
three potential landing zones, bringing the number of landing zones to at most 9 (as there are now
only 9 black squares despite there being 13 white squares).
It can also be proven that marking 3 black squares cannot block more than 3 potential landing zones.
This shows that the answer is exactly 9. To do this, number the squares on the chess board as shown in
the diagram. A spaceship can always land with one side on an even-numbered square with number n,
and the other side on square n+1.
If the squares are ‘unfolded’ from the board, in the order that they were numbered, the following chain
is made:

Marking a tree on a black square basically means ripping the chain into two parts at the place of the
black square that you marked. If a chain is ripped with n black squares into two parts, there is a left
side and a right side. Each side starts and ends with a white square and has alternating white and black
squares. The total number of black squares is now n-1.
For instance, if tree 4 is marked first, this creates two chains of 1-3 and 5-25. If tree 8 is then marked, the
second chain is split up into 5-7 and 9-25. If tree 10 is then marked, the rightmost chain is split into 9-9
and 11-25.

For each of the chains the developer can still land exactly as many spaceships as there are
black squares.
So this shows that if the ranger marks 3 trees in black squares, they will block exactly 3 landing zones.

BACKGROUND INFORMATION
Solving this task by trying out every combination of marking 3 trees and then figuring out how many
spaceships could still land is called a brute force strategy and would take a very long time. This task
highlights the power of some logical thinking tricks that involve abstraction. In order to solve this task,
the spaceships need to be abstracted as 2x1 rectangles that are placed on a board filled with squares.
Often times these 2x1 rectangles are called ‘dominoes’, just like in the game.
In addition to what is asked in this question, there are some clever algorithms that exist that can show
how many different ways the spaceships could land.

100
This question comes from Years 3+4
Austria Years 5+6
Years 7+8

Turing Machines
Years 9+10
Years 11+12 Hard

A Turing machine is a computational model of a computer. It consists of a state (shown on the green
screen) and a read/write head (orange arrow) that operates on a tape containing symbols. The head
can move left (L) or right (R) one symbol at a time. The machine always starts in state “0” (initial state),
as shown below.

Our version of the Turing machine can run programs and each line of such program consists of 5
elements as shown in the following short program:

When the program is executed, the first line (from the top) with matching current state and symbol
at the current head position is used to determine a new symbol to overwrite the tape at the current
position, a direction for moving the head and a new state for the machine. “_” denotes the space
character. The “halt” state stops the program. Empty lines are only used for formatting. The program
above removes leading zeroes from binary numbers, arriving to this final state:

From the initial state, the head moves right until it hits the first 0, remaining in state 0. Here, given the
3rd rule, the machine replaces this first 0 with a space, moving right and remaining in state 0. Now the
head reads “1”, so the machine leaves this alone on the tape, moving right and into state 1. The next
symbol is a space, so according to the program, the machine leaves the space on the tape and moves
back to state 0. The process continues this way until the machine reaches the final state shown above.

Continued on next page


101
This question comes from Years 3+4
Austria Years 5+6
Years 7+8

Turing Machines – continued


Years 9+10
Years 11+12 Hard

Question
What does the following program do?

“*” in column 2 means “any character”.


“*” in column 3 means “same character
that was read”

A) The program replaces “1”s with “2”s.

B) The program replaces “2”s with “1”s.

C) When finding a group of “1”-symbols the program prints “t” (true) if the number of “1”s is even.
Otherwise it prints “f” (false).

D) When finding a group of “1”-symbols the program prints “t” (true) if the number of 1s is odd.
Otherwise it prints “f” (false).

EXPLANATION
Answer
C: When finding a group of “1”-symbols the program prints “t” (true) if the number of “1”s is even.
Otherwise it prints “f” (false).

Explanation
The correct answer is option C: When finding a group of “1”-symbols the program prints “t” (true) if the
number of “1”s is even. Otherwise it prints “f” (false).
In the starting state, the line [0 * * r 0] means that all symbols except the “1”s are skipped. The first line
changes to state “1” if a “1”-symbol is detected.
Being in state “1” means, that an odd number of “1”s was detected so far. If another “1” is detected,
the machine changes to state “2”. If anything other than “1” is detected, the machine prints out “t”

Continued on next page


102
This question comes from Years 3+4
Austria Years 5+6
Years 7+8

Turing Machines – continued


Years 9+10
Years 11+12 Hard

and halts. Being in state “2” means that an even number of “1”s was detected so far. If another “1” is
detected, the machine changes to “state 1”. If anything other than “1” is detected, the machine prints
out “f” and halts.
This is exactly the result that was suggested by option C).

Option A: The program replaces “1”s with “2”s.


If the program replaced all “1”s with “2”s, we would expect a line in the program with “1” in the second
column and “2” in the third column. This is not the case. Option A) can be ruled out.

Option B: The program replaces “2”s with “1”s.


Similarly, as above, to replace “2”s with “1”s, we should have “2” or ‘*’ in the second column (current
symbol) and a “1” in the third column (new symbol). But we do not have such lines. So B) is incorrect.

Option D: When finding a group of “1”-symbols the program prints “t” (true) if the number of 1s
is odd. Otherwise it prints “f” (false).
The correct answer (C) implies this option is incorrect. In detail: an even number of “1”s leads us to
state “1” (either from state “0” by reading a “1” or from state “2” by reading another “1”).
In either case, from state “1”, with an even number of “1”, we can either:
a) read another “1” leading us to state “2” but having now an even number of “1”s; or b) read a different
symbol, terminating the program with output “f” (false). Hence, option (D) is incorrect.

BACKGROUND INFORMATION
A Turing machine is a computational model for a computer, developed by the British mathematician
Alan Turing in 1936. Although Turing machines are a simple concept, researchers agree that any
algorithm that runs on a classic computer can also run on a Turing machine, although not very
efficiently. Conversely, if one can show that an algorithm can not be run on a Turing machine, that
algorithm can not be run on a classical computer either. So we can think of a Turing machine as a
computer that is reduced as much as possible to draw conclusions and find general properties of
classical computers. Quantum computers have to be seen as an exception, they do not fall in the same
category as classical computers.

103
This question comes from Years 3+4
Uruguay Years 5+6
Years 7+8

Mastermind
Years 9+10
Years 11+12 Hard

Isla is playing Mastermind on her computer: The computer makes up a password from four distinct
digits. The player can submit several guesses of this password. Each time, the computer responds with
the number of correct digits, which appear both in the guess and in the password. Also, it tells the
player whether they placed these digits in the right positions.
Isla made some guesses (?). From the responses given, she was able to discover the password.

? ? ? ?
5 7 2 0 One of the digits is correct and in the proper position.
6 0 3 1 One of the digits is correct, but not in the proper position.
1 4 8 5 Two digits are correct, but they are not in the proper positions.
1 5 9 6 None of the digits are correct.
8 1 2 5 One of the digits is correct, but not in the proper position.

Question
What is the password?

EXPLANATION

Answer
The password is 3748.

Explanation
To arrive at this number we must systematically follow a procedure according to the information
available. This process must be iterative. One of the ways to solve it is to subdivide the problem and
first try to discover the digits and then the correct order.
From the first row (guess plus response) we know that only one of the given digits is part of the
password. The second and third rows provide similar information.
The fourth row then helps to extract more information from rows one to three: We can discard 5 from
the first guess, 6 from the second guess, and 1 and 5 from the third guess. From this last step we know
that 4 and 8 are parts of the password. Then the correct digit in the fifth guess is 8; from that we can
conclude from row five that 1, 2 and 5 are not parts of the password.
If we go back to rows one and two, the possibly correct numbers are 7 or 0 in row one, and 3 or 0 in
row two. Thus, we have 5 possible numbers 0,3,4,7 and 8. If 0 was in the password, then both 7 and 3
would need to be discarded given that only one number is correct for rows one and two. This would
leave only 0,4,8 as possible numbers in the password. Given that the password must contain four
unique numbers, 0 cannot be correct. Therefore, the other digits that complete the code must be
3 and 7.

Continued on next page


104
This question comes from Years 3+4
Uruguay Years 5+6
Years 7+8

Mastermind – continued
Years 9+10
Years 11+12 Hard

Now we consider the information of the position or order. From rows three and five, we know that
8 can be in positions 2 or 4:
?-8-?-8
and that 4 can be in all positions but 2:
4-?-4-4
From row one we know that 7 must be in position 2; then, 8 must be in position 4. From row two we
know that 3 cannot be in position 3, so that it must be in position 1. Hence, 4 is in position 3. This gives
the only possible option for the password which is:
3-7-4-8

BACKGROUND INFORMATION
Logic plays a key role in computer science (databases, computational complexity, programming
languages, artificial intelligence, hardware and software design and verification, etc.), and is
undoubtedly one of the foundations that provide the maturity and agility to assimilate the future
computer science concepts, languages, techniques, etc.
There are some complex algorithms that use the same logic flow to detect intruders in computer
networks, or errors in logic circuits. As it can be hard to examine each part individually, a batch of test
questions is sent and based on the answers the presence of an intruder/error can be determined.

105
This question comes from Years 3+4
the United States Years 5+6
Years 7+8

Truth Table
Years 9+10
Years 11+12 Hard

A truth table describes the output (O or ) for one or more input variables. The diagram below
describes what the output will be for all different combinations of x, y and z. This truth table can also
be described as a formula by just listing exactly for which input values the output would be :

x y z output (x=O and y=O and z= ) or


O O O O (x= and y=O and z=O) or
O O (x= and y=O and z= ) or
O O O (x= and y= and z= O) or
O O (x= and y= and z= )
O O
In this case there are exactly 15 input symbols.
O
O

Analysing this table shows that the output is always when x= , so this formula can be reduced to
four symbols:
(x=O and y=O and z= ) or (x= )
This can be shortened further - this table can be represented with just three symbols:
(y=O and z= ) or (x= )

This shortest representation of three symbols can be drawn in the following diagram:

Here, (y=O and z= ) is represented by the 1x2 red rectangle and (x= ) is represented by the 4x1
red rectangle.

Continued on next page


106
This question comes from Years 3+4
the United States Years 5+6
Years 7+8

Truth Table – continued


Years 9+10
Years 11+12 Hard

Question
Here is a much bigger table, again paired with a matching diagram with the same information
(note the order of the ‘c’ and ‘d’):

a b c c output
O O O O O
O O O O
O O O O
O O O
O O O O
O O O
O O
O O
O O O
O O
O O
O
O O
O
O
O

What is the lowest number of symbols that needs to be used to describe this truth table?

107
This question comes from Years 3+4
the United States Years 5+6
Years 7+8

Truth Table – continued


Years 9+10
Years 11+12 Hard

EXPLANATION

Answer
The correct answer is 7.

Explanation
You can find this by looking in the diagram with the circled groups. These diagrams are called
Karnaugh maps.
The size of the circled output symbols basically indicates how many symbols you need to describe
each group.
For this table that has inputs for four symbols:
To describe a single output symbol, you will need four input symbols. To describe two adjacent
symbols, you will need three input symbols. To describe four adjacent output symbols (either in 4x1,
1x4, or 2x2) you will need two input symbols, and to describe eight adjacent symbols (2x4 or 4x2)
you need only a single input symbol.
This diagram shows three groups, two groups of 4 output symbols (2x2 and 4x1), and 1 group of 2
output symbols (1x2). So the answer is 2 + 2 + 3 = 7.
There should be a rule for each of the three groups in the Karnaugh map - the 2x2 group, the 4x1 group
and the 1x2 group. The final notation of input values would be the following three rules with a total
of 7 input symbols:
(a= and c= O) or
(a= and b= O) or
(b= and c= and d= O)

BACKGROUND INFORMATION
Karnaugh maps are used to simplify logic tables, so they can be expressed using a minimum number
of logical gates. When building circuits, the cost of the circuit depends on how many elements are
needed in the circuit. Any way by which fewer inputs can be used was seen as positive. Karnaugh maps
help find this minimal set of inputs.
Karnaugh maps are useful because they have been designed so that in order to move from one square
to an adjacent square, never more than one bit has to be changed. Do note that the squares wrap
around! From the top square in a column to the bottom square in the same column is also a single
change. Because of this special property, if two adjacent squares both contain an output of ‘1’, the bit
that flips to move between them is not needed in the final expression, and both rows can be combined
from the truth table.
Karnaugh maps used to be used to also find potential problems in logical circuits called race
conditions.
Karnaugh maps work well up to 4 variables. This may not seem like a lot, but many small circuits have
4 or fewer inputs, or can be split into multiple circuits of fewer than 4 variables.

108
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Log Sort
Years 9+10
Years 11+12 Hard

Tree logs of different sizes are in a river. Beaver Hamid’s task is to sort the logs by size. Hamid moves
along the riverbank, always taking a position between two logs. Hamid compares these two logs by
size and swaps them if necessary.
Hamid knows the logs can be sorted in the following way, no matter how the logs come in initially:
Start at the position on the right of the leftmost log.
Repeat the following until you are on the right of the rightmost log:
• If the log on the left is smaller than the right log: move to the right by one log.
• If the log on the right is smaller than the left log:
– swap these logs;
– unless you are at the starting position: move to the left by one log.
See how Hamid sorts 4 logs in this way. In this example, Hamid has to move 9 times.

The number of times Hamid has to move to sort a group of logs depends on how the logs come in
initially. In the worst case, Hamid would have to move 25 times to sort 6 logs. In the best case (when
the 6 logs are already sorted) Hamid would still have to move 5 times.

Question
Which of the ranges below is the smallest range that will always include how many times Hamid
has to move when sorting all starting arrangements of 60 logs?

0...60 10...90 59...300 59...3,600 59...216,000

Continued on next page


109
This question comes from Years 3+4
Germany Years 5+6
Years 7+8

Log Sort – cont’d


Years 9+10
Years 11+12 Hard

EXPLANATION
Answer
59...3,600.

Explanation
[0...60] is wrong. Even in the best case, when the logs are sorted, Hamid has to make 59 moves.
More moves are required if the logs are out of order quickly taking the moves required to beyond 60.
[10...90] and [59..300] are also wrong. To prove it, we need to explore the worst case, when logs are
sorted in the opposite order. In this case, Hamid reaches a log on the kth position and moves it to the
first (leftmost) position, then goes for a log on the (k+1)th position. So for the log on the kth position,
we need to move k-2 times right to reach it, and k-2 times left to put it in the beginning. Thus, we
obtain the sum 2(1+2+...+58) and we need to add 59 moves from the leftmost to the rightmost position
at the end of the algorithm. The sum is exactly 592=3481. This number does not belong to any of these
two ranges.
[59...3600] is correct. To see it, we need to prove that the worst case is really the worst one. When
Hamid reaches the log in the kth position, all previous logs are already sorted properly, so he needs only
to put this new log in the correct position among the previous ones. Then he goes to the log on the
(k+1)th position. So, the smaller is the log on kth position, the greater number of move it requires.
[59...216,000] does include how many times Hamid will have to move when sorting the logs no matter
what their starting positions but this range is not the smallest range that does this.

BACKGROUND INFORMATION
In Computer Science, sorting algorithms are used to put a sequence of objects in a certain order. The
most frequently used orders are numerical order (for numbers) and lexicographical order (for all kinds
of data based on an ordered alphabet). Efficient sorting is important for optimising the efficiency of
other algorithms, such as search algorithms that require input data to be sorted. Also, sorting can be
useful for canonicalising data and for producing human-readable output.
One of the most well-known sorting algorithms is the gnome sort. It is conceptually simple - by
working with one item at a time, the algorithm gets each item to its proper place by a series of swaps.
If the list is initially almost sorted, it works with n swaps for n objects. The gnome sort (sometimes
dubbed “stupid sort”) was originally proposed by the Iranian computer scientist Hamid Sarbazi-Azad
(professor of Computer Science and Engineering at Sharif University of Technology) in the year 2000.
When speaking of an algorithm we always need to consider how ‘fast’ it is, i.e. the number of
operations it requires to sort items in the worst or most disordered case, depending on the number
of elements needed to be sorted. For this algorithm, if we have n objects, we need approximately
n2 operations. This is called a quadratic relationship. The other answers in this task represent other
possible relationships: constant (independent) for [0...60], linear for [10...90], log-linear for [59...300]
and really big (actually increasing by the power of 3) for [59...216,000].
This relationship for a particular algorithm is called the algorithm complexity and is studied in
computational complexity theory.

110
We would like to thank the International Bebras Committee and community for their ongoing assistance, resources
and collaborative efforts. Special thanks to Eljakim Schrijvers, Alieke Stijf and Dave Oostendorp for their support and
technical expertise.

If you would like to contribute a question to the International Bebras community, please contact us via the details below.

Contact us
CSIRO Digital Careers
[email protected]
csiro.au/Digital-Careers

Australia’s National Science Agency

You might also like