CF730J Bottles
Description
Nick has $ n $ bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda $ a_{i} $ and bottle volume $ b_{i} $ ( $ a_{i}
Input Format
The first line contains positive integer $ n $ ( $ 1
Output Format
The only line should contain two integers $ k $ and $ t $ , where $ k $ is the minimal number of bottles that can store all the soda and $ t $ is the minimal time to pour the soda into $ k $ bottles.
Explanation/Hint
In the first example Nick can pour soda from the first bottle to the second bottle. It will take 3 seconds. After it the second bottle will contain $ 3+3=6 $ units of soda. Then he can pour soda from the fourth bottle to the second bottle and to the third bottle: one unit to the second and two units to the third. It will take $ 1+2=3 $ seconds. So, all the soda will be in two bottles and he will spend $ 3+3=6 $ seconds to do it.