Get Lowest Free solution codechef – Chef buys 33 items having prices AA, BB and CC respectively. What is the amount of money Chef needs to pay?

  1. Get Lowest Free solution codechef

Chef goes to the supermarket to buy some items. Luckily there’s a sale going on under which Chef gets the following offer:

  • If Chef buys 33 items then he gets the item (out of those 33 items) having the lowest price as free.

For e.g. if Chef bought 33 items with the cost 6622 and 44, then he would get the item with cost 22 as free. So he would only have to pay the cost of the other two items which will be 6+4=106+4=10.

Chef buys 33 items having prices AABB and CC respectively. What is the amount of money Chef needs to pay?

Each test contains multiple test cases. The first line contains a single integer 𝑡t (1𝑡1041≤t≤104) — the number of test cases. Descriptions of test cases follow.

The first line of each test case contains three integers 𝑛n𝑙l𝑘k (2𝑘𝑙𝑛500002≤k≤l≤n≤50000𝑘20k≤20).

Get Lowest Free solution codechef

Each of the next 𝑛n lines contains two integers 𝑥𝑖xi𝑦𝑖yi (108𝑥𝑖,𝑦𝑖108−108≤xi,yi≤108) — the coordinates of the point 𝐴𝑖Ai. It is guaranteed that all points are distinct and were generated independently from uniform distribution on [108,108]×[108,108][−108,108]×[−108,108].

It is guaranteed that the sum of 𝑛n for all test cases does not exceed 5000050000.

In the first test, points were not generated from the uniform distribution on [108,108]×[108,108][−108,108]×[−108,108] for simplicity. It is the only such test and your solution must pass it.

Hacks are disabled in this problem.

Output

For each test case print a single real number — the answer to the problem.

Your answer will be considered correct if its absolute or relative error does not exceed 10910−9. Formally let your answer be 𝑎a, jury answer be 𝑏b. Your answer will be considered correct if |𝑎𝑏|max(1,|𝑏|)109|a−b|max(1,|b|)≤10−9.

Get Lowest Free solution codechef

 

3
6 2 4
3 3 3
8 4 4

Sample Output 1 

10
6
12

Get Lowest Free solution codechef

Test case-1: Explained in the problem statement.

Test case-2: Since all the three items have the same price, Chef will get one of them free and will have to pay the cost of the other two items which will be 3+3=63+3=6.

Test case-3: Chef will get one of the items having price 44 as free and will have to pay the cost of the other two items which will be 8+4=128+4=12.

Note

In the first test case, we can select subsegment 𝐴1,𝐴2A1,A2 and a circle with center (0,2)(0,2) and radius 22.

In the second test case, we can select subsegment 𝐴1,𝐴2,𝐴3,𝐴4A1,A2,A3,A4 and a circle with center (1,2)(1,2) and radius 11.

Leave a Comment