Shopping Center
Time limit2sMemory limit1024 MB
Given n buses with departure times and travel durations, find the minimum of t_i plus l_i over all buses.
- Level
Easy1 of 10
- Topics
- Implementation, Array
- Solved
- No attempts yet
Problem
Kendis wants to go to the shopping center to hang out with Jeremy. She checked the bus schedule and found that buses will leave from near their home toward the shopping center today. The -th bus will stop near their home minutes from now and takes minutes to travel from home to the shopping center. Find the earliest time Kendis can arrive at the shopping center.
Input
The first line contains one integer , the number of buses (). Each of the next lines contains two integers and : the number of minutes until the -th bus passes by Kendis's home, and the number of minutes the -th bus takes to travel from home to the shopping center ().
Output
Print one integer, the minimum number of minutes after which Kendis can arrive at the shopping center.