{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\u0027text/css\u0027\u003e .input, .output {border: 1px solid #888888;} .output {margin-bottom:1em;position:relative;top:-1px;} .output pre,.input pre {background-color:#EFEFEF;line-height:1.25em;margin:0;padding:0.25em;} .title {background-color:#FFFFFF;border-bottom: 1px solid #888888;font-family:arial;font-weight:bold;padding:0.25em;} \u003c/style\u003e \u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027]], displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027]]}\n });\n \u003c/script\u003e\n \u003cscript type\u003d\"text/javascript\" async\n src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\n \u003c/script\u003e\n\n\u003cp\u003e大栗根据2048发明了新的游戏2047,其过程如下,对于一个数列中相邻且相同的元素a\u003csub\u003ei\u003c/sub\u003e,a\u003csub\u003ei+1\u003c/sub\u003e合并,合并后变为a\u003csub\u003ei\u003c/sub\u003e+1放回第i位,i+1位删除,后面的数列依次前移。当同时有多组相邻且相同的元素时选取最左边的一对合并。依次进行直至不能合并例如对于数列(5,4,4,4,3,3),第一次有三组满足要求的位置,选取最左侧的合并变为(5,5,4,3,3);这时候有两组相邻且相同的元素,选取最左边的变为(6,4,3,3);然后选取第三位第四位变为(6,4,4);最终变为(6,5)且无法合并\u003c/p\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e共两行\u003c/p\u003e\n\u003cp\u003e第一行一个整数n(2 ≤ n ≤ 2*10\u003csup\u003e5\u003c/sup\u003e),表示数列长度\u003c/p\u003e\n\u003cp\u003e第二行n个空格分割的整数a\u003csub\u003e1\u003c/sub\u003e, a\u003csub\u003e2\u003c/sub\u003e, ..., a\u003csub\u003en\u003c/sub\u003e(1 ≤ a\u003csub\u003ei\u003c/sub\u003e ≤ 10\u003csup\u003e9\u003c/sup\u003e).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e共两行\u003c/p\u003e\n\u003cp\u003e第一行一个整数k,表示最终数列长度\u003c/p\u003e\n\u003cp\u003e第二行k个空格分割的整数a\u003csub\u003e1\u003c/sub\u003e, a\u003csub\u003e2\u003c/sub\u003e, ..., a\u003csub\u003ek\u003c/sub\u003e,表示最终数列\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003cp\u003e输入\u003c/\u003e\n\u003cp\u003e6\u003c/p\u003e\n\u003cp\u003e5 4 4 4 3 3\u003c/p\u003e\n\u003cp\u003e输出\u003c/p\u003e\n\u003cp\u003e2\u003c/p\u003e\n\u003cp\u003e6 5\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp\u003e输入\u003c/\u003e\n\u003cp\u003e7\u003c/p\u003e\n\u003cp\u003e8 9 21 10 52 5 6\u003c/p\u003e\n\u003cp\u003e输出\u003c/p\u003e\n\u003cp\u003e7\u003c/p\u003e\n\u003cp\u003e8 9 21 10 52 5 6\u003c/p\u003e"}},{"title":"Note","value":{"format":"HTML","content":""}}]}