#Q4. 「一本通 1.1 例 4」加工生产调度
「一本通 1.1 例 4」加工生产调度
Description
A factory has received an order for products. These products need to be processed in workshops A and B, and they must be processed in workshop A before they can be processed in workshop B.
The processing times for product in workshops A and B are and , respectively. Determine the optimal processing sequence for these products to minimize the total processing time.
Here, the total processing time refers to the time from the start of processing the first product until all products have completed processing in both workshops A and B.
Input Format
The first line contains a single integer , representing the number of products.
The next numbers represent the processing times for each product in workshop A.
The last numbers represent the processing times for each product in workshop B.
Output Format
The first line should contain a single integer, the minimum total processing time.
The second line should list one possible processing sequence that achieves this minimum time.
Sample 1
5
3 5 8 7 10
6 2 1 4 9
34
1 5 4 2 3
Data Range and Hint
For of the data, , .
Note: The SPJ for this problem is sensitive to trailing spaces. Please ensure there are no trailing spaces at the end of your output lines.