Kletva
As punishment for destroying half of his city with his monster truck, Mirko now has to pay off his dept to society. He works as an assistant for a famous archaeologist. One of his duties include crafting keys for ancient document boxes. In ancient times document boxes were locked using elaborate mechanisms with interesting locks. Each lock is L centimeters long and W centimeters wide and consists of three parts, the upper edge, the lower edge and the empty area between them. Both edges can be represented as a sequence of L nonnegative integers: r1 r2 r3 ... rL. Each number in sequence represents the width of edge at that point. The key for each lock is a small clay tab, fitting perfectly in the area between edges. This image shows a 7 cm long, 8 cm wide lock along with the corresponding key.
8 7 2
2 1 3 2 3 2 3
3 4 2 3 2 3 4
3 2 4 3 4 3 4
2 3 1 2 1 2 3Output:
18 4 4
3 3 3 3
3 3 3 3
2 2 2 2
4 4 4 4
1 2 3 4
4 3 2 1
1 1 1 1
5 5 5 5Output:
2Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.