{"problem":{"name":"F. Lonely Dreamoon 2","description":{"content":"Dreamoon, who doesn't have a girlfriend, often goes for a walk along some streets in Taipei while thinking about problems from algorithm competitions. Unfortunately, there are so many couples acting l","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10123F"},"statements":[{"statement_type":"Markdown","content":"Dreamoon, who doesn't have a girlfriend, often goes for a walk along some streets in Taipei while thinking about problems from algorithm competitions. Unfortunately, there are so many couples acting lovey-dovey on the street that Dreamoon can not focus on thinking about those problems.\n\nOne day, despite the love birds everywhere, Dreamoon discovered a problem input containing an integer sequence: a1, a2, a3, ..., aN.\n\nDreamoon thought: because I'm single, every pair of consecutive numbers should have a large difference! This is, Dreamoon wants to reorder the sequence to make the value  as large as possible.\n\nSo Dreamoon turned on Drazil, who does have a girlfriend, and forced Drazil to fulfill the above condition by reordering the integer sequence. Please help poor Drazil  > _ < \n\nThe input consists of two lines. The first line contains an integer N. The second line consists of N integers a1, a2, ..., aN.\n\nOutput a single line consisting of N integers, denoting the integer sequence a after reordering. For this reordering, the value  must be the largest possible among all reorderings of the input sequence. If there are several possible answers, output any one of them.\n\n## Input\n\nThe input consists of two lines. The first line contains an integer N. The second line consists of N integers a1, a2, ..., aN.  2 ≤ N ≤ 2 × 105   - 109 ≤ ai ≤ 109 \n\n## Output\n\nOutput a single line consisting of N integers, denoting the integer sequence a after reordering. For this reordering, the value  must be the largest possible among all reorderings of the input sequence. If there are several possible answers, output any one of them.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $ be the length of the sequence.  \nLet $ A = (a_1, a_2, \\dots, a_N) $ be a sequence of real numbers.\n\n**Objective**  \nFind a permutation $ B = (b_1, b_2, \\dots, b_N) $ of $ A $ that maximizes:  \n$$\n\\sum_{i=1}^{N-1} |b_i - b_{i+1}|\n$$\n\n**Constraints**  \n- $ 1 \\leq N \\leq 100 $  \n- $ a_i \\in \\mathbb{R} $ for all $ i \\in \\{1, \\dots, N\\} $ (typically integers in practice)","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10123F","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}