You are given an array nums of size n containing positive integers and an array queries of size m, where queries[i] = [index_i, k_i].
Initially, all elements in nums are unmarked. You need to process each query sequentially in the following manner:
Mark the element located at index index_i if it is not already marked.
Mark up to k_i unmarked elements that have the smallest values. If there is a tie in values, choose the elements with the smallest indices. If there are fewer than k_i unmarked elements remaining, mark all of them.
Calculate the sum of all unmarked elements in nums after completing the steps above.
Return an array of integers representing the sum of unmarked elements after each query.
Constraints:
n nums.length
m queries.length
nums[i]
queries[i].length
index_i, k_i
You are given an array nums of size n containing positive integers and an array queries of size m, where queries[i] = [index_i, k_i].
Initially, all elements in nums are unmarked. You need to process each query sequentially in the following manner:
Mark the element located at index index_i if it is not already marked.
Mark up to k_i unmarked elements that have the smallest values. If there is a tie in values, choose the elements with the smallest indices. If there are fewer than k_i unmarked elements remaining, mark all of them.
Calculate the sum of all unmarked elements in nums after completing the steps above.
Return an array of integers representing the sum of unmarked elements after each query.
Constraints:
n nums.length
m queries.length
nums[i]
queries[i].length
index_i, k_i