{"problem":{"name":"Make M","description":{"content":"Let $N$ be a positive **odd** number. A sequence of integers of length $N$, $S = (S_1, S_2, \\dots, S_N)$, is said to be **M-type** if \"for each even number $i = 2, 4, \\dots, N - 1$, it holds that $S_{","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc161_a"},"statements":[{"statement_type":"Markdown","content":"Let $N$ be a positive **odd** number. A sequence of integers of length $N$, $S = (S_1, S_2, \\dots, S_N)$, is said to be **M-type** if \"for each even number $i = 2, 4, \\dots, N - 1$, it holds that $S_{i-1} < S_i$ and $S_i > S_{i+1}$\".\nYou are given a sequence of positive integers of length $N$, $A = (A_1, A_2, \\dots, A_N)$. Determine if it is possible to rearrange $A$ to be M-type.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $N$ is an **odd** number.\n*   $1 \\leq A_i \\leq 10^9 \\ \\ (1 \\leq i \\leq N)$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$A_1 \\ A_2 \\ \\dots \\ A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc161_a","tags":[],"sample_group":[["5\n1 2 3 4 5","Yes\n\nThe given sequence is $A = (1, 2, 3, 4, 5)$. After rearranging it, for example, to $B = (4, 5, 1, 3, 2)$,\n\n*   for $i = 2$, it holds that $B_1 = 4 < 5 = B_2$ and $B_2 = 5 > 1 = B_3$;\n*   for $i = 4$, it holds that $B_3 = 1 < 3 = B_4$ and $B_4 = 3 > 2 = B_5$.\n\nTherefore, this sequence $B$ is M-type, and the answer is `Yes`."],["5\n1 6 1 6 1","Yes\n\nThe given sequence $A$ itself is M-type."],["5\n1 6 6 6 1","No\n\nIt is impossible to rearrange it to be M-type."]],"created_at":"2026-03-03 11:01:14"}}