nums1[i] with nums2[i] and store them in an array pairs.pairs by the second element (nums2[i]) in descending order.top_k_heap to store the first k elements of nums1 from the sorted pairs.top_k_sum to store the sum of elements in top_k_heap.answer with the product of top_k_sum and pairs[k - 1][1].pairs starting from index k:
top_k_heap and subtract it from top_k_sum.nums1[i] to top_k_heap and add it to top_k_sum.top_k_sum times nums2[i].answer if the current score is greater than the previous maximum.answer as the maximum possible score.