Electronics Shop

Publicado el: 01 enero 1970
en el canal de: 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.


En esta página del sitio puede ver el video en línea Electronics Shop de Duración hora minuto segunda en buena calidad , que subió el usuario Shital Luitel 01 enero 1970, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 65 veces y le gustó 1 a los espectadores. Disfruta viendo!