You are on page 1of 7

2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 1

Solutions
Part A: Questions 1–6

1. Dos
All three players can organise their hand in 2 moves as shown:

Y R G B Y R B Y
G R Y
Y R Y B G G
R
B Y Y R R YG
B GR R B Y BY R
BR
Y RG Y
Y G

↓ ↓ ↓

Y Y B G R Y G
G Y
B R R Y R B G
Y R
B B Y Y R Y
B Y GR R R GB Y Y G Y BRR
Y R G

Ahmed Bryn Carol


Hence (E).

2. River Crossings
The numbers in the yellow circles represent the smallest cost to reach that point.
The path with the red centre shows how to reach that point with the smallest cost.

2 2
4 4
Start
0 8
6
0 9 3 2
2
7 14
1

5 2
2 15
3 13 2
Finish
5
2

The smallest cost to travel from Start to Finish is 15. Hence (B).
Page 20
2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 2

3. Buried Treasure
Solution 1: Try all possibilities
We know that the treasure is at 540 m E, 600 m N.
We try each pirate in turn, swapping his N and E distances until the five instructions
lead to the treasure. We find that Bluebeard wrote down his instructions incorrectly.
Hence (E).
Solution 2: Algebra
Trying all possibilities is manageable with only five pirates, but would become cumber-
some rather quickly as the number of pirates increased. A little algebra can help.
The treasure is at 540 m E, 600 m N. The pirates’ directions lead to 500 m E, 640 m N.
The difference is 40 m E, –40 m N.
One pirate’s direction went from (e,n) to (n,e). That is a difference of (n − e, e − n).
So we are looking for the pirate whose E − N is –40. He turns out to be Bluebeard.
Pirate E N E−N
Olaf 120 80 40
Hook 140 90 50
Sinbad 60 150 –90
Noah 100 200 –100
Bluebeard 80 120 −40
Hence (E).

Page 21
2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 3

4. Dusty Paddock to Greener Pastures


We have to be sure that each sheep can be watered on both nights.
For the first night, this is easy. We don’t send more sheep to a waterhole than can be
waterered at it. But we also have to ensure that there will be enough water for all sheep
on the second night.

Here we can send 30 sheep to the first Here we can only send 25 sheep to the
waterhole as they can all be sent to a first waterhole as there is not enough
waterhole on the second night. water for any more on the second night.

20 20 15 10
30 25
30 10 30 10
15 15

Our approach will be to start from the top, sending as many sheep to each waterhole as
is consistent with their having enough water for both nights.
We could also start from the bottom. This would give different movements of sheep, but
the same number of sheep moved.
Working from the top Working from the bottom
20 10
20 20 20 10
40 40
20 40 30 40
30 30
30 10 30
80 80
70 80 80 80
80 80
80 10 80
20 20
10 20 20 20
70 80
90 60 90 60
60 60
60 60
20 20
20 20 20 20
40 40
20 50 20 50
20 20
20 20

Either way, 240 sheep can be moved to the greener pastures. Hence (C).

Page 22
2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 4

5. Heterograms
The trees of GODWIT, CURLEW, OSPREY and PLOVER are
G C O P

D O U E S L V

I W R W P Y E O R

T L R

None of them match

Hence (A).

6. Sightseeing Trip
There are four ways of crossing the first two bridges.

 

 

Whichever way I go, I must leave out a section between the second and third bridges.
Similarly, I must leave out a section between the fourth and fifth bridges and a section
between the sixth and seventh bridges. In each case I can choose either of the sides
between the bridges.
The smallest total of these is 3 + 2 + 1 = 6. There are 39 tourist attractions altogether.
So I can visit 39 − 6 = 33 of them. Hence (C).

Page 23
2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 5

Part B: Questions 7–9

7. Team Photo
A. 6, 4, 7, 9, 1, 8, 2, 5
When a player arrives, Zara will direct her to the left of the line if her number is
greater than that of the player on the left end of the line. Otherwise she will direct
her to the right end of the line.
6 → 64 → 764 → · · · → 97641825
Hence 612.

B. 1, 6, 4, 3, 5, 7, 2, 9, 8
1 → 61 → 614 → · · · → 976143528
Hence 645.

C. 6, 4, 7, 9, 1, 8, 2, 5
The player with 8 on her back arrives after the player with 9. Unless Zara delays
the player with 9, the player with 8 is directed to the right of the line. However,
if Zara delays the player with 9, she can direct the player with 8 to the left of the
line. Then, when all of the other players have arrived, Zara will direct player with
9 to the left of the line.
6 → 64 → 764 → · · · → 8764125 → 98764125

Hence 742.

8. Penelope’s Chores
Solution 1
We simply add up the replacement chores.

A. E D E D E
E DE DE →  E DE DE →  E E
DE DE E E → ··· →  D
ED
E E
E E
E
Penelope has to perform 9 chores.

B. B C
BC → 
B CCC → 
BCC
CDDDDDD → 
BCC
C D
 D
DD
DDE E E E E E E E E E E E
Penelope has to perform 22 chores.

C. A B C D E
Unrealistic to work it out this way! See Solution 2.

Solution 2
It does not matter in which order Penelope does her chores. So we build a table of how
many chores to complete an initial A, an initial B, etc.
E →  E 1 chore.
D →  DEE 3 chores.
C → C DDEEEE 7 chores.
B →  BC C
 D
 D
 D
 D
 E E E E
E E E E 15 chores.
A →  ABBC
CCC D
 DDD DDDDE
EE EEEE E E
EE
EE
EE
E 31 chores.
Page 24
2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 6

A. E D E D E
There are 2 Ds and 3 Es for a total of 2 × 3 + 3 = 9 chores.
B. B C
There is 1 B and 1 C for a total of 15 + 7 = 22 chores.
C. A B C D E
There is 1 each of A, B, C, D and E for a total of 31 + 15 + 7 + 3 + 1 = 57 chores.
Solution 3
We can shortcut the construction of the table.
E →  E 1 chore.
D →  DE E 1+2×1 3 chores.
C → C DD 1+2×3 7 chores.
B →  B CC 1 + 2 × 7 15 chores.
A →  A B B 1 + 2 × 15 31 chores.
The details are now the same as in Solution 2.

9. Stacking Packages
Our approach to this solution will be guided by a number of insights.
1. Once a package has been placed above another on a table it can never be below
that package subsequently on the same table.
This is true regardless of whether there are other packages between them.
2. When you move two or more packages from one table to the other you reverse
their order.
In the solutions below, we will end up with all of the packages on the left-hand table.
A. 1, 2, 5, 6, 4, 3
When the 6 arrives the left-hand table (L) should be empty. As the 1, 2 and 5 have
already arrived they must be on the right-hand table (R). From insights 1 and 2
above, the order on table R will be 5, 2, 1 with 5 on top.
This can be achieved by putting each parcel on table R as it arrives.
Packages 1, 2, 5 arrive Package 6 arrives

5 5
2 2
1 6 1

The remainder of the packing is straightforward.

Package 5 moved Packages 4, 3 arrive Packages 2, 1 moved

1
2
3 3
4 4
5 2 5 2 5
6 1 6 1 6

Page 25
2022 Computational and Algorithmic Thinking — Junior Solutions

Computational and Algorithmic Thinking 2022 (Junior Solutions) 7

A total of 3 + 1 + 1 + 2 + 2 = 9 movements are required.

We can now extend our insights.

3. When the heaviest parcel arrives the preceding parcels must be on table R in
descending order.

4. When any parcel arrives, the preceding parcels on table L must be in ascending
order and those on table R in descending order.

We use these insights to guide our solutions.

B. 2, 1, 4, 3, 6, 5

Packages 2, 1 arrive Packages 4, 3 arrive Package 4 moved Packages 4, 3, 2, 1 moved


Package 2 moved Packages 6, 5 arrive

1
2
4 3
3 3 4
2 2 5 2 5
1 4 1 6 1 6

A total of 3 + 2 + 3 + 4 = 12 movements are required.

C. 3, 5, 1, 6, 2, 4
3, 5 arrive 1 arrives 6 arrives 3 moved 4 arrives
3 moved 3, 5 moved 5 moved 2 arrives 3, 2, 1 moved
3 moved 1
2
3
5 3 4
3 3 5 3 5 2 5
5 1 6 1 6 1 6

A total of 3 + 3 + 2 + 3 + 4 = 15 movements are required.

Page 26

You might also like