Chef and Ice Cream SOLUTIONS CHEF1001

Chef and Ice Cream SOLUTION

Gourmet expert and his companion like to pool their cash and go to the frozen yogurt parlor. Gourmet expert never purchases similar flavor as his companion does. The main other guideline they have is that they go through the entirety of their cash. Given top notch of costs for the kinds of frozen yogurt, select the two that will cost the entirety of the cash they have. 


Info Format: 

The principal line contains a whole number, m, indicating the quantity of excursions to the frozen yogurt parlor. The following arrangements of lines each portray a visit. Each outing is depicted as follows: 


1.The whole number , m,the measure of cash they have pooled. 


2.The whole number ,n,the number of flavors offered at that point. 


3.n,space-isolated whole numbers meaning the expense of each flavor. 










1≤cost[i] ≤104 


Yield Format 


For each experiment, print two space-isolated whole numbers meaning the files of the two flavors bought, in rising request. 


Test Input: 





1 4 5 3 2 




2 4 3 


Test Output: 


1 4 


1 2

Leave a Comment

error: Content is protected !!