Professional Documents
Culture Documents
...with tunan
...who also thinks writing the title in lowercase looks cool or something
Problem 1: Stray Cat
●
Connected, N nodes, M ●
A = N, B = 0
edges ●
A = 4, B = 0
●
You can mark each edge a ●
A = 3, B = 0, Tree
certain colour from 0 to A-1
●
A = 3, B = 0
●
You are to guide a probe that
spawns on some arbitrary ●
A = 2, B = 2N, Tree
node ●
A = 2, B = 12, Tree
●
The probe has to take at ●
A = 2, B = 6, Tree
most s+B steps where s is
the shortest path
Can you prove that A = 2 on general graph is impossible?
2
Working Space
3
Working Space
4
Problem 2: Mech Doll
●
You are to build a circuit in which a ball ●
Let S be the number of
will roll around in. This can be modelled
as a directed graph with 3 types of nodes: switches used. S ≤ N + log2
●
Origin: 1 exit leading out. Ball starts here. N
●
Trigger: 1 exit leading out. Each trigger – Each value appears at most
has a unique ID. once in A.
Switch: 2 exits x and y. The exit the ball
Each value appears at most
●
–
goes through alternates x, y, x, y…
twice in A.
●
Design a circuit such that:
– It has M triggers
– There is only one trigger.
– When the ball leaves the origin, it hits – S ≤ 2N
triggers in a given sequence A of length N,
leaves all the switches state to x, and then – No further constraints.
goes back to the origin.
5
Working Space
6
Working Space
7
Interactives are pretty ad-hoc
●
Interactive problems are normally made up of recognisable
components, but demand that you remix them in ridiculous
ways
●
Binary Search
8
Linear search > Binary search
●
Suppose you had N Things ●
Binary search
at integer positions on the
number line from 1 to M.
●
You can ask queries: How
many Things have position
less than x? ●
Linear search
●
Find positions where there
are Things.
9
Working Space
10
lol
11
SQRT Search
●
Place initial search position K
positions forward
●
If too far, binary search
●
If not far enough, advance K
12
Working Space
13