Scheduling - MarisaOJ: Marisa Online Judge

Scheduling

Time limit: 1000 ms
Memory limit: 256 MB
Marisa wants to prepare a set of $n$ potion bottles. Each bottle requires a certain amount of time to be filled and labeled. The $i$-th bottle takes $A_i$ seconds to be filled and $B_i$ seconds to be labeled. A bottle must be filled before being labeled. Marisa has two machines, one for filling potions and another one for labeling. However, each machine can process only one bottle at a time. Marisa wants to find the minimum amount of time required to prepare all $n$ potion bottles. ### Input - The first line contains an integer $n$. - The next $n$ lines, the $i^{th}$ line contains two integer $A_i,B_i$. ### Output - Print an integer is the minimum amount of time required. ### Constraints - $1 \le n \le 10$. - $1 \le A_i,B_i \le 10^9$. ### Example Input: ``` 2 1 3 2 3 ``` Output: ``` 7 ```
Topic
Complete Search
Rating 800
Solution (0) Solution