When multiple tasks are executed on a single CPU, they are not truly run in parallel. Instead, the CPU spends some time on each task in turn, and a scheduler is used to decide which task to run at any given time. Real-world schedulers are quite complex and must try to balance conflicting priorities.
For the purposes of this problem, we will consider only a simple "round-robin" scheduler. There are N tasks, numbered 0 to N-1. The scheduler runs each task in turn for one second, starting with task 0 and proceeding with tasks 1, 2, ..., N-1, before starting again at 0. Once a task completes executing, the scheduler will skip over that task in future.
Element i of tasks is the number of seconds of execution time required by task i. Return N integers, the ith of which is the total time the system has been running when task i completes.
|-||tasks will contain between 1 and 50 elements, inclusive.|
|-||Every element of tasks will be between 1 and 20,000,000, inclusive.|