{"problem":{"name":"Job Assignment","description":{"content":"Your company has $N$ employees, called Employee $1$ through $N$.   You have received two work orders, called Work A and B, which must be completed.   Employee $i$ can complete Work A in $A_i$ minutes ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc194_b"},"statements":[{"statement_type":"Markdown","content":"Your company has $N$ employees, called Employee $1$ through $N$.  \nYou have received two work orders, called Work A and B, which must be completed.  \nEmployee $i$ can complete Work A in $A_i$ minutes and Work B in $B_i$ minutes.\nYou will assign each work to one employee.  \nYou can assign both works to the same employee, in which case the time it takes for him/her to complete them is the sum of the times it takes for him/her to do them individually.  \nIf you assign the works to different employees, the time it takes for them to complete them is the longer of the times it takes for them to do their respective works.  \nFind the shortest possible time needed to complete the works.\n\n## Constraints\n\n*   $2 \\le N \\le 1000$\n*   $1 \\le A_i \\le 10^5$\n*   $1 \\le B_i \\le 10^5$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$A_3$ $B_3$\n$\\hspace{15pt} \\vdots$\n$A_N$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc194_b","tags":[],"sample_group":[["3\n8 5\n4 4\n7 9","5\n\nIf you assign Work A to Employee $2$ and Work B to Employee $1$, they will complete them in $4$ and $5$ minutes, respectively.  \nSince you assigned the works to different employees, it will take $\\max(4, 5) = 5$ minutes for the two works to be finished.  \nIt is impossible to finish them earlier."],["3\n11 7\n3 2\n6 7","5\n\nIt is optimal to assign both works to Employee $2$.  \nNote that if you assign both works to the same employee, the time it takes for him/her to complete them is the sum of the times it takes for him/her to do them individually."]],"created_at":"2026-03-03 11:01:14"}}