{"raw_statement":[{"iden":"statement","content":"You have a problem set of ten problems. Each team in the contest has a skill level from 1 to 10 and each of the ten problems has a difficulty level from 1 to 10. A team can only solve problems that have a difficulty level less than or equal to their skill level.\n\nYou want to add one more problem with difficulty from 1 to 10 such that each team solves *at least* one problem. What is the maximum difficulty that this problem can have? \n\nThe first line of input contains n (1 ≤ n ≤ 32), the number of teams participating in the contest.\n\nThe second line of input contains n integers si (1 ≤ si ≤ 10), the skill level of the teams.\n\nThe third line of input contains 10 integers di (1 ≤ di ≤ 10), the difficulty level of the problems in the problem set so far.\n\nOutput on a single line the maximum possible difficulty level for the new problem from 1 to 10 such that each team solves *at least* one problem.\n\n"},{"iden":"input","content":"The first line of input contains n (1 ≤ n ≤ 32), the number of teams participating in the contest.The second line of input contains n integers si (1 ≤ si ≤ 10), the skill level of the teams.The third line of input contains 10 integers di (1 ≤ di ≤ 10), the difficulty level of the problems in the problem set so far."},{"iden":"output","content":"Output on a single line the maximum possible difficulty level for the new problem from 1 to 10 such that each team solves *at least* one problem."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of teams.  \nLet $ S = \\{s_1, s_2, \\dots, s_n\\} \\subseteq \\{1, 2, \\dots, 10\\} $ be the set of team skill levels.  \nLet $ D = \\{d_1, d_2, \\dots, d_{10}\\} \\subseteq \\{1, 2, \\dots, 10\\} $ be the set of existing problem difficulties.  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 32 $  \n2. $ 1 \\leq s_i \\leq 10 $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. $ 1 \\leq d_j \\leq 10 $ for all $ j \\in \\{1, \\dots, 10\\} $  \n\n**Objective**  \nFind the maximum $ x \\in \\{1, 2, \\dots, 10\\} $ such that for every team skill level $ s \\in S $, there exists at least one problem (either in $ D $ or the new problem with difficulty $ x $) with difficulty $ \\leq s $.  \n\nThat is, define the set of solvable problems for team $ s $ as $ D \\cup \\{x\\} \\cap \\{1, 2, \\dots, s\\} $.  \nWe require:  \n$$\n\\forall s \\in S,\\quad \\left( D \\cap \\{1, 2, \\dots, s\\} \\right) \\cup \\left( \\{x\\} \\cap \\{1, 2, \\dots, s\\} \\right) \\neq \\emptyset\n$$  \nMaximize $ x \\in \\{1, 2, \\dots, 10\\} $ satisfying the above.","simple_statement":"Find the highest difficulty (1 to 10) for a new problem so that every team can solve at least one problem.","has_page_source":false}