{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\u003cscript type\u003d\"text/x-mathjax-config\"\u003eMathJax.Hub.Config({messageStyle:\"none\",tex2jax:{skipTags:[\"script\",\"noscript\",\"style\",\"textarea\",\"code\"],inlineMath:[[\u0027\\\\(\u0027,\u0027\\\\)\u0027]]},delayStartupUntil:\"onload\"});\u003c/script\u003e\n\u003cscript src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config\u003dTeX-MML-AM_CHTML\"\u003e\u003c/script\u003e\n\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003eWe have a pyramid with \u003cvar\u003e\\(N\\)\u003c/var\u003e steps, built with blocks. The steps are numbered \u003cvar\u003e\\(1\\)\u003c/var\u003e through \u003cvar\u003e\\(N\\)\u003c/var\u003e from top to bottom. For each \u003cvar\u003e\\(1≤i≤N\\)\u003c/var\u003e, step \u003cvar\u003e\\(i\\)\u003c/var\u003e consists of \u003cvar\u003e\\(2i-1\\)\u003c/var\u003e blocks aligned horizontally. The pyramid is built so that the blocks at the centers of the steps are aligned vertically.\u003c/p\u003e \n\u003cdiv style\u003d\"text-align: center;\"\u003e \n \u003cimg src\u003d\"CDN_BASE_URL/066b28d24b2b252a3c2d04f65b213236?v\u003d1610785904\"\u003e \n \u003cp\u003eA pyramid with \u003cvar\u003e\\(N\u003d4\\)\u003c/var\u003e steps\u003c/p\u003e \n\u003c/div\u003e \n\u003cp\u003eSnuke wrote a permutation of (\u003cvar\u003e\\(1\\)\u003c/var\u003e, \u003cvar\u003e\\(2\\)\u003c/var\u003e, \u003cvar\u003e\\(...\\)\u003c/var\u003e, \u003cvar\u003e\\(2N-1\\)\u003c/var\u003e) into the blocks of step \u003cvar\u003e\\(N\\)\u003c/var\u003e. Then, he wrote integers into all remaining blocks, under the following rule:\u003c/p\u003e \n\u003cul\u003e \n \u003cli\u003eThe integer written into a block \u003cvar\u003e\\(b\\)\u003c/var\u003e must be equal to the median of the three integers written into the three blocks directly under \u003cvar\u003e\\(b\\)\u003c/var\u003e, or to the lower left or lower right of \u003cvar\u003e\\(b\\)\u003c/var\u003e.\u003c/li\u003e \n\u003c/ul\u003e \n\u003cdiv style\u003d\"text-align: center;\"\u003e \n \u003cimg src\u003d\"CDN_BASE_URL/7068d1a3fa02594ff917272d48bffabf?v\u003d1610785904\"\u003e \n \u003cp\u003eWriting integers into the blocks\u003c/p\u003e \n\u003c/div\u003e \n\u003cp\u003eAfterwards, he erased all integers written into the blocks. Now, he only remembers that the permutation written into the blocks of step \u003cvar\u003e\\(N\\)\u003c/var\u003e was (\u003cvar\u003e\\(a_1\\)\u003c/var\u003e, \u003cvar\u003e\\(a_2\\)\u003c/var\u003e, \u003cvar\u003e\\(...\\)\u003c/var\u003e, \u003cvar\u003e\\(a_{2N-1}\\)\u003c/var\u003e).\u003c/p\u003e \n\u003cp\u003eFind the integer written into the block of step \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/p\u003e\n\u003cpre\u003e\n给定一个形如\n #\n ###\n #####\n #######\n #########\n的方格图,最底层填入2*n-1长度的排列\n除此之外每一层的每格都是下层最接近的三格中的中位数,\n给定最下层元素,求最上层元素\n\u003c/pre\u003e"}},{"title":"Constraints","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cul\u003e \n \u003cli\u003e\u003cvar\u003e\\(2≤N≤10^5\\)\u003c/var\u003e\u003c/li\u003e \n \u003cli\u003e(\u003cvar\u003e\\(a_1\\)\u003c/var\u003e, \u003cvar\u003e\\(a_2\\)\u003c/var\u003e, \u003cvar\u003e\\(...\\)\u003c/var\u003e, \u003cvar\u003e\\(a_{2N-1}\\)\u003c/var\u003e) is a permutation of (\u003cvar\u003e\\(1\\)\u003c/var\u003e, \u003cvar\u003e\\(2\\)\u003c/var\u003e, \u003cvar\u003e\\(...\\)\u003c/var\u003e, \u003cvar\u003e\\(2N-1\\)\u003c/var\u003e).\u003c/li\u003e \n\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003eThe input is given from Standard Input in the following format:\u003c/p\u003e \n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\n\u003cvar\u003e\\(a_1\\)\u003c/var\u003e \u003cvar\u003e\\(a_2\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(a_{2N-1}\\)\u003c/var\u003e\n\u003c/pre\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003ePrint the integer written into the block of step \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/p\u003e"}},{"title":"Sample Input 1","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e4\n1 6 3 7 4 5 2\n\u003c/pre\u003e"}},{"title":"Sample Output 1","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e4\n\u003c/pre\u003e \n\u003cp\u003eThis case corresponds to the figure in the problem statement.\u003c/p\u003e"}},{"title":"Sample Input 2","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e2\n1 2 3\n\u003c/pre\u003e"}},{"title":"Sample Output 2","value":{"format":"HTML","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e2\n\u003c/pre\u003e"}}]}