Kim Incheon's Grocery Store (Large)
InterviewTime limit5sMemory limit512 MB
Given 2N sorted tags that pair N sale prices with regular prices at 4/3 of each sale price, recover the N sale tags.
Problem
Kim Incheon, who owns a grocery store in Incheon, is preparing a store wide sale. To keep the arithmetic simple he decided to sell every item at a 25% discount, so the sale price of an item is exactly 75% of its regular price. Every regular price in the store is an integer multiple of 4, so every sale price is an integer too.
While setting up the sale he printed a sale price tag for every item, and he also printed a regular price tag for every item to put back after the sale ends.
A customer came in, and while he was away the printer sorted all of the tags by price in ascending order without separating the two kinds and produced a single stack. The sale tag and the regular tag of every item are somewhere in that stack. The two kinds of tags look the same, and Kim Incheon does not remember the price of every item.
For example, if three items have regular prices 20, 80 and 100, their sale prices are 15, 60 and 75, and the printed stack is sorted as 15, 20, 60, 75, 80, 100.
Given the prices in the stack, find the prices that are written on the sale tags.
Input
The first line contains the number of test cases . Then test cases follow, and each test case consists of two lines. The first line contains the number of items in the store, . The second line contains the integers that the printer produced in ascending order of price.
- for every
- for every
- The answer is guaranteed to be unique.
Output
For each test case print one line in the format Case #x: y, where is the test case number starting from 1 and is the integers written on the sale tags, sorted in ascending order and separated by single spaces.
Hint
Several items can share the same price, and the sale price of one item can equal the regular price of another item.