{"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":"MD","content":"构造一个值域为 [1,N],长度为 N 的单调不降序列 A。并且使得 \\forall 1\\leq k\\leq N-1,都有任意 k 个数之和小于任意 k+1 个数之和。\n求构造方案数,对 M 取模。"}},{"title":"Constraints","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cul\u003e \n \u003cli\u003e\u003cvar\u003e\\(2 \\leq N \\leq 5000\\)\u003c/var\u003e\u003c/li\u003e \n \u003cli\u003e\u003cvar\u003e\\(9 \\times 10^8 \u0026lt; M \u0026lt; 10^9\\)\u003c/var\u003e\u003c/li\u003e \n \u003cli\u003e\u003cvar\u003e\\(M\\)\u003c/var\u003e is a prime.\u003c/li\u003e \n \u003cli\u003eAll input values are integers.\u003c/li\u003e \n\u003c/ul\u003e"}},{"title":"Input","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e \n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(M\\)\u003c/var\u003e\n\u003c/pre\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cp\u003ePrint the number of ways to assign scores to the problems, modulo \u003cvar\u003e\\(M\\)\u003c/var\u003e.\u003c/p\u003e"}},{"title":"Sample Input 1","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e2 998244353\n\u003c/pre\u003e"}},{"title":"Sample Output 1","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e3\n\u003c/pre\u003e \n\u003cp\u003eThe possible assignments are \u003cvar\u003e\\((1, 1)\\)\u003c/var\u003e, \u003cvar\u003e\\((1, 2)\\)\u003c/var\u003e, \u003cvar\u003e\\((2, 2)\\)\u003c/var\u003e.\u003c/p\u003e"}},{"title":"Sample Input 2","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e3 998244353\n\u003c/pre\u003e"}},{"title":"Sample Output 2","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e7\n\u003c/pre\u003e \n\u003cp\u003eThe possible assignments are \u003cvar\u003e\\((1, 1, 1)\\)\u003c/var\u003e, \u003cvar\u003e\\((1, 2, 2)\\)\u003c/var\u003e, \u003cvar\u003e\\((1, 3, 3)\\)\u003c/var\u003e, \u003cvar\u003e\\((2, 2, 2)\\)\u003c/var\u003e, \u003cvar\u003e\\((2, 2, 3)\\)\u003c/var\u003e, \u003cvar\u003e\\((2, 3, 3)\\)\u003c/var\u003e, \u003cvar\u003e\\((3, 3, 3)\\)\u003c/var\u003e.\u003c/p\u003e"}},{"title":"Sample Input 3","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e6 966666661\n\u003c/pre\u003e"}},{"title":"Sample Output 3","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e66\n\u003c/pre\u003e"}},{"title":"Sample Input 4","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e96 925309799\n\u003c/pre\u003e"}},{"title":"Sample Output 4","value":{"format":"MD","content":"\u003ch3\u003e\u003c/h3\u003e\n\u003cpre\u003e83779\n\u003c/pre\u003e"}}]}