$ ctf42

Gift_Wrapping

Misc weight 24.40 No technique tags yet.
Difficulty Not rated yet

Author: souvlakia

programming

Welcome to the North Pole!!! πŸŽ…πŸŽ…πŸŽ… Santa needs your help to deliver gifts to children all around the world 🎁🎁🎁 He only has one gift wrapping machine and has N gifts to wrap. The machine can only wrap K area of a gift at a time. You are given K and the current state of the conveyor belt that contains the area of each gift. (E.g. 10 21 5 ... means gift 0 has area 10, gift 1 has area 21 and so on) The belt is moving and you can only wrap the gifts in the order they appear. When a gift is fully wrapped, it is sent to the sleigh and out of the belt πŸ›·πŸ›·πŸ›· If a gift hasn't been fully wrapped, it goes back to the end of the conveyor belt, and will be wrapped later. Tell Santa the order of the gifts that will be sent to the sleigh so he can plan his route πŸ—ΊοΈπŸ—ΊοΈπŸ—ΊοΈ Don't take too long, Christmas is almost here !!! πŸŽ„πŸŽ„πŸŽ„

Example 1: Belt: [10, 21, 5] K: 5 Solution: [2, 0, 1] (Gift 2 is wrapped first, then 0, then 1)

Example 2: Belt: [6, 8, 10] K: 25 Solution: [0, 1, 2]

Use the provided solve.py and fill in the solve function.

Author: souvlakia

Writeups

Official

Community

No community writeups yet. Solved it? Share how.

Log in to add a community writeup.