Helmet and Vest
InterviewTime limit1sMemory limit512 MB
Given a list of helmet defense values and a list of vest values, print the sum of the best helmet and the best vest.
- Level
Easy1 of 10
- Topics
- Array, Implementation, Brute force, Math
- Solved
- No attempts yet
Problem
In the game Battlegrounds, a player wears a helmet and a vest to protect the head and the body.
The map holds many helmets and vests, and each one has its own defense value. A player can wear at most one helmet and at most one vest. Gyeongsu wants to win, so he is willing to spend the time it takes to pick up the best helmet and the best vest and reach the highest defense.
Given the defense values of the helmets and the vests on the map, find the largest defense Gyeongsu can reach.

Input
The first line contains the number of helmets and the number of vests on the map. and are natural numbers not greater than 1000. The second line contains the defense value of each helmet, values in total. The third line contains the defense value of each vest, values in total. Every defense value is a natural number not greater than 1 billion.
Output
Print the largest defense Gyeongsu can reach.