#abc331e. E - Set Meal
E - Set Meal
Score : points
问题描述
AtCoder 食堂出售由一道主菜和一道配菜组成的套餐。
有 种类型的主菜,分别称为主菜 、主菜 、……、主菜 。其中,主菜 的价格为 日元。
另有 种类型的配菜,分别称为配菜 、配菜 、……、配菜 。其中,配菜 的价格为 日元。
一份套餐通过选择一种主菜和一种配菜组成。套餐的价格是所选主菜和配菜价格之和。
然而,对于 对不搭配的主菜和配菜组合 ,它们无法组成套餐。也就是说,共有 种不同的套餐可供选择。(题目约束条件保证至少提供一种套餐。)
请找出所有提供的套餐中价格最高的那份套餐的价格。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
AtCoder cafeteria sells meals consisting of a main dish and a side dish.
There are types of main dishes, called main dish , main dish , , main dish . Main dish costs yen.
There are types of side dishes, called side dish , side dish , , side dish . Side dish costs yen.
A set meal is composed by choosing one main dish and one side dish. The price of a set meal is the sum of the prices of the chosen main dish and side dish.
However, for distinct pairs , the set meal consisting of main dish and side dish is not offered because they do not go well together.
That is, set meals are offered. (The constraints guarantee that at least one set meal is offered.)
Find the price of the most expensive set meal offered.
Constraints
- if .
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the price, in yen, of the most expensive set meal offered.
Sample Input 1
2 3 3
2 1
10 30 20
1 2
2 1
2 3
Sample Output 1
31
They offer three set meals, listed below, along with their prices:
- A set meal consisting of main dish and side dish , at a price of yen.
- A set meal consisting of main dish and side dish , at a price of yen.
- A set meal consisting of main dish and side dish , at a price of yen.
Among them, the most expensive is the third one. Thus, print .
Sample Input 2
2 1 0
1000000000 1
1000000000
Sample Output 2
2000000000
Sample Input 3
10 10 10
47718 21994 74148 76721 98917 73766 29598 59035 69293 29127
7017 46004 16086 62644 74928 57404 32168 45794 19493 71590
1 3
2 6
4 5
5 4
5 5
5 6
5 7
5 8
5 10
7 3
Sample Output 3
149076
update @ 2024/3/10 01:15:54