{"problem":{"name":"G. World Mug (B)","description":{"content":"The organizers of the tournament wish to ensure a great amount of fun for the fans, for that, they have decided to rearrange the teams such that more goals in the tournament are scored. Can you help ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10179G"},"statements":[{"statement_type":"Markdown","content":"The organizers of the tournament wish to ensure a great amount of fun for the fans, for that, they have decided to rearrange the teams such that more goals in the tournament are scored.\n\nCan you help out by calculating the maximum number of goals that could be scored if the teams were rearranged optimally?\n\nThe first line of input contains one integer n (2 ≤ n ≤ 218), the number of teams participating in the tournament. It is guaranteed that the number of teams is a power of two (i.e., 2, 4, 8, 16, ...).\n\nThe second line contains n *distinct* integers, the ith integer is si (1 ≤ si ≤ 109), the strength of the ith team.\n\nOn a single line, print the maximum number of goals that could be scored in the tournament if the teams were rearranged to maximize that number.\n\n## Input\n\nThe first line of input contains one integer n (2 ≤ n ≤ 218), the number of teams participating in the tournament. It is guaranteed that the number of teams is a power of two (i.e., 2, 4, 8, 16, ...).The second line contains n *distinct* integers, the ith integer is si (1 ≤ si ≤ 109), the strength of the ith team.\n\n## Output\n\nOn a single line, print the maximum number of goals that could be scored in the tournament if the teams were rearranged to maximize that number.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n = 2^k $ for some $ k \\in \\mathbb{Z}^+ $, the number of teams.  \nLet $ S = \\{s_1, s_2, \\dots, s_n\\} $ be a set of distinct positive integers representing team strengths.\n\n**Constraints**  \n1. $ 2 \\leq n \\leq 218 $ and $ n $ is a power of two.  \n2. $ 1 \\leq s_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $.  \n3. All $ s_i $ are distinct.\n\n**Objective**  \nMaximize the total number of goals scored in a single-elimination tournament, where in each match between two teams, the number of goals scored equals the **maximum** of the two teams' strengths.  \nCompute the maximum possible total goals over all possible initial bracket arrangements.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10179G","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}