We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
定點乘法器設計(中文)
運算符:
+ 對其兩邊的數據作加法操作; A + B
- 從左邊的數據中減去右邊的數據; A - B
- 對跟在其后的數據作取補操作,即用0減去跟在其后的數據; - B
* 對其兩邊的數據作乘法操作; A * B
& 對其兩邊的數據按位作與操作; A & B
# 對其兩邊的數據按位作或操作; A # B
@ 對其兩邊的數據按位作異或操作; A @ B
~ 對跟在其后的數據作按位取反操作; ~ B
<< 以右邊的數據為移位量將左邊的數據左移; A << B
$ 將其兩邊的數據按從左至右順序拼接; A $ B