Electronics Shop

Опубликовано: 01 Январь 1970
на канале: Shital Luitel
65
1

Monica wants to buy exactly one keyboard and one USB drive from her favorite electronics store. The store sells n different brands of keyboards and n different brands of USB drives. Monica has exactly dollars to spend, and she wants to spend as much of it as possible (i.e., the total cost of her purchase must be maximal).

Given the price lists for the store's keyboards and USB drives, find and print the amount money Monica will spend. If she doesn't have enough money to buy one keyboard and one USB drive, print -1 instead.

Note: She will never buy more than one keyboard and one USB drive even if she has the leftover money to do so.

Input Format

The first line contains three space-separated integers describing the respective values of s (the amount of money Monica has), n (the number of keyboard brands) and m (the number of USB drive brands).
The second line contains space-separated integers denoting the prices of each keyboard brand.
The third line contains space-separated integers denoting the prices of each USB drive brand.


На этой странице сайта вы можете посмотреть видео онлайн Electronics Shop длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Shital Luitel 01 Январь 1970, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 65 раз и оно понравилось 1 зрителям. Приятного просмотра!