type taskHeap []intfunc(h *taskHeap)Len()int{returnlen(*h)}func(h *taskHeap)Less(i, j int)bool{return(*h)[i]<(*h)[j]}func(h *taskHeap)Swap(i, j int){(*h)[i],(*h)[j]=(*h)[j],(*h)[i]}func(h *taskHeap)Push(x interface{}){*h =append(*h, x.(int))}func(h *taskHeap)Pop()interface{}{
old :=*h
n :=len(old)
x := old[n-1]*h = old[0: n-1]return x
}functopK(all []int, k int)[]int{
h :=new(taskHeap)
heap.Init(h)for_, each :=range all {if h.Len()< k {
heap.Push(h, each)}elseif(*h)[0].Duration < each.Duration {
heap.Pop(h)
heap.Push(h, each)}}return*h
}