{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e .sampledata { font-family: \"Courier New\", Courier, monospace; white-space: pre; }\u003c/style\u003eA linear sequence is an ordered triple (s1,s2,s3) where the difference\u0026nbsp;\n\u003cbr\u003e s2-s1 is the same as the difference s3-s2. Examples include: (1,2,3),\u0026nbsp;\n\u003cbr\u003e (2,4,6), and (14,21,28).\u0026nbsp;\n\u003cbr\u003e \n\u003cbr\u003e Given L (4 \u0026lt;\u003d L \u0026lt;\u003d 13), the size of an ordered set of integers, and\u0026nbsp;\n\u003cbr\u003e M (L \u0026lt; M \u0026lt;\u003d 35), the maximum possible integer in the set, find all\u0026nbsp;\n\u003cbr\u003e the ordered sets with L integer elements in the range 1..M such\u0026nbsp;\n\u003cbr\u003e that no three of the set\u0027s elements form a linear sequence.\u0026nbsp;\n\u003cbr\u003e \n\u003cbr\u003e Your program should print the \u0027first\u0027 three of these sets (or fewer\u0026nbsp;\n\u003cbr\u003e than three if there are not three) where sets are compared\u0026nbsp;\n\u003cbr\u003e element-by-element (such that, e.g., the set {1, 2, 4} precedes {1,\u0026nbsp;\n\u003cbr\u003e 3, 4}). The final output line is the total number of sequences with\u0026nbsp;\n\u003cbr\u003e no linear subsequences.\u0026nbsp;\n\u003cbr\u003e \n\u003cbr\u003e Do not use pre-calculation to solve this problem.\u0026nbsp;\n\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cspan\u003e* Line 1: Two space-separated integers: L and M\u0026nbsp;\u003c/span\u003e\n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"* Lines 1..3?: Each of the lines should contain L sorted,\n\u003cbr\u003e \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; space-separated integers with no linear subsequences.\n\u003cbr\u003e \n\u003cbr\u003e * Line 4?: The final line of the output is a single integer that is\n\u003cbr\u003e \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; the count of the number of sequences with no linear\n\u003cbr\u003e \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; subsequences. It is guaranteed that this number fits in a\n\u003cbr\u003e \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; signed 32-bit integer.\n\u003cbr\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cspan class\u003dsampledata\u003e5 9 \r\nINPUT DETAILS: \r\nSets of length 5 whose integers are in the range 1..9 \u003c/span\u003e\u003c/pre\u003e\u003ch2\u003eSample Output\u003c/h2\u003e\n\u003cpre class\u003dcontent\u003e\u003cspan class\u003dsampledata\u003e1 2 4 8 9 \r\n1 2 6 7 9 \r\n1 2 6 8 9 \r\n4 \r\nOUTPUT DETAILS: \r\nThe fourth one is: \r\n1 3 4 8 9\u003c/span\u003e\u003c/pre\u003e\u003ch2\u003eHINT\u003c/h2\u003e\n\u003cdiv class\u003dcontent\u003e\u003cp\u003e\u003c/p\u003e\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cspan class\u003dsampledata\u003e1 2 4 8 9 \r\n1 2 6 7 9 \r\n1 2 6 8 9 \r\n4 \r\nOUTPUT DETAILS: \r\nThe fourth one is: \r\n1 3 4 8 9\u003c/span\u003e\u003c/pre\u003e\u003ch2\u003eHINT\u003c/h2\u003e\n\u003cdiv class\u003dcontent\u003e\u003cp\u003e\u003c/p\u003e\u003c/div\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e\u003c/p\u003e"}}]}