harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-1949harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-1949Akash received his money from CodeChef today and decided to have dinner at a restaurant that offers a menu with N items. Each item on the menu belongs to a specific category and requires a certain cooking time.
Akash wants to have a complete meal, which means he must order at least K distinct categories of food. Your task is to help Akash determine the minimum cooking time required for his meal, or to indicate if it is not possible to have a complete meal.
For each test case, output a single integer on a new line:
4
3 1
1 2 3
2 1 3
8 3
1 3 2 2 4 1 3 5
3 3 0 1 2 4 1 4
1 1
5
1
5 3
1 1 2 2 1
1 1 0 3 5
1
3
1
-1
Test case 1: Akash can choose the dish with index 2 (category 2), requiring a total time of 1.
Test case 2: Akash can select dishes at indices 3, 5, and 7:
The total time for the complete meal is 0 + 2 + 1 = 3, which is the minimum time.
Test case 3: The only available dish has category 5 and requires a total time of 1.
Test case 4: There are only 2 distinct categories available, less than K, making it impossible to have a complete meal.
Place your solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.