309058: CF1618D. Array and Operations
Memory Limit:512 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Array and Operations
题意翻译
给定 $n$ 个数和一个数 $k$,要求对这 $n$ 个数进行 $k$ 次操作,每次操作取出两个数 $a_i,a_j (i\neq j)$,并将 $\lfloor \frac{a_i}{a_j} \rfloor$ 加进得分中,其中 $\lfloor \frac{x}{y} \rfloor$ 为不超过 $\frac{x}{y}$ 的最大整数。 $k$ 次操作后,将剩下的 $n-2k$ 个数直接加入到得分中。 求最终得分的最小值。题目描述
You are given an array $ a $ of $ n $ integers, and another integer $ k $ such that $ 2k \le n $ . You have to perform exactly $ k $ operations with this array. In one operation, you have to choose two elements of the array (let them be $ a_i $ and $ a_j $ ; they can be equal or different, but their positions in the array must not be the same), remove them from the array, and add $ \lfloor \frac{a_i}{a_j} \rfloor $ to your score, where $ \lfloor \frac{x}{y} \rfloor $ is the maximum integer not exceeding $ \frac{x}{y} $ . Initially, your score is $ 0 $ . After you perform exactly $ k $ operations, you add all the remaining elements of the array to the score. Calculate the minimum possible score you can get.输入输出格式
输入格式
The first line of the input contains one integer $ t $ ( $ 1 \le t \le 500 $ ) — the number of test cases. Each test case consists of two lines. The first line contains two integers $ n $ and $ k $ ( $ 1 \le n \le 100 $ ; $ 0 \le k \le \lfloor \frac{n}{2} \rfloor $ ). The second line contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \le a_i \le 2 \cdot 10^5 $ ).
输出格式
Print one integer — the minimum possible score you can get.
输入输出样例
输入样例 #1
5
7 3
1 1 1 2 1 3 1
5 1
5 5 5 5 5
4 2
1 3 3 7
2 0
4 2
9 2
1 10 10 1 10 2 7 10 3
输出样例 #1
2
16
0
6
16