you give n task label 0 n 1 represent 2D integer array task tasksi enqueueTimei processingtimei mean ith task available process enqueuetimei processingtimei finish processingyou singlethreaded cpu process task time act follow wayif CPU idle available task process CPU remain idleif CPU idle available task CPU choose short processing time if multiple task short processing time choose task small indexonce task start cpu process entire task stoppingThe CPU finish task start new instantlyreturn order cpu process task Example 1input task 12243241output 0231explanation the event follow at time 1 task 0 available process available task 0 also time 1 idle CPU start process task 0 available task at time 2 task 1 available process available task 1 at time 3 task 2 available process available task 1 2 also time 3 CPU finish task 0 start process task 2 short available task 1 at time 4 task 3 available process available task 1 3 at time 5 CPU finish task 2 start process task 3 short available task 1 at time 6 CPU finish task 3 start process task 1 available task at time 10 CPU finish task 1 idleExample 2input task 710712757472output 43201explanation the event follow at time 7 task available available task 01234 also time 7 idle CPU start process task 4 available task 0123 at time 9 CPU finish task 4 start process task 3 available task 012 at time 13 CPU finish task 3 start process task 2 available task 01 at time 18 CPU finish task 2 start process task 0 available task 1 at time 28 CPU finish task 0 start process task 1 available task at time 40 CPU finish task 1 idle Constraintstaskslength n1 n 1051 enqueueTimei processingTimei 109