Pixel · Easy CodeFree
Out of Hand
The baker stacks layers as they come out of the oven. Two matching layers on top fuse into one taller layer of the next flavour, and that can set off another fusion. What cake gets the cherry?
Write the finished cake, from the bottom layer to the top.
Every layer must be exactly right.
N, the number of layers.N lines: F h, the flavour (S, L or B) and height of each layer, in the order they arrive.M, the number of layers of the finished cake.M lines: F h for each layer, from the bottom to the top.N ≤ 100, 1 ≤ h ≤ 108 B 1 L 1 S 1 S 1 L 2 L 3 S 2 B 1
4 S 4 B 5 S 2 B 1
Sign in to play. It is free.
Sign in