#C10445. Taco Maximum Profit
Taco Maximum Profit
Taco Maximum Profit
You are given three lists of integers:
- arr1: A list of buying prices.
- arr2: A list provided for compatibility (not used in the calculation).
- arr3: A list of selling prices.
Your task is to calculate the maximum profit obtainable by buying at the minimum price from arr1 and selling at the maximum price from arr3. The profit is computed by the formula:
$$\text{profit} = \max\Big(0, \max(arr3) - \min(arr1)\Big)$$
If no profit can be made, output 0.
inputFormat
The input consists of three lines:
- The first line contains a space-separated list of integers representing arr1 (buying prices).
- The second line contains a space-separated list of integers representing arr2 (this list is not used in the profit calculation).
- The third line contains a space-separated list of integers representing arr3 (selling prices).
outputFormat
Output a single integer representing the maximum profit computed as:
$$\text{profit} = \max\Big(0, \max(arr3) - \min(arr1)\Big)$$
## sample4 3 1 2
7 5 8 9 2 6
10 2 15 4 8
14