{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can\u0027t predict the quality of milk from one day to the next, there are some regular patterns in the daily milk quality.\u003c/p\u003e\u003cp\u003eTo perform a rigorous study, he has invented a complex classification scheme by which each milk sample is recorded as an integer between 0 and 1,000,000 inclusive, and has recorded data from a single cow over \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 20,000) days. He wishes to find the longest pattern of samples which repeats identically at least K (2 ≤ \u003ci\u003eK\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e) times. This may include overlapping patterns -- 1 2 3 2 3 2 3 1 repeats 2 3 2 3 twice, for example.\u003c/p\u003e\u003cp\u003eHelp Farmer John by finding the longest repeating subsequence in the sequence of samples. It is guaranteed that at least one subsequence is repeated at least \u003ci\u003eK\u003c/i\u003e times.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: Two space-separated integers: \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eK\u003c/i\u003e\r\u003cbr\u003eLines 2..\u003ci\u003eN\u003c/i\u003e+1: \u003ci\u003eN\u003c/i\u003e integers, one per line, the quality of the milk on day \u003ci\u003ei\u003c/i\u003e appears on the \u003ci\u003ei\u003c/i\u003eth line."}},{"title":"Output","value":{"format":"HTML","content":"Line 1: One integer, the length of the longest pattern which occurs at least \u003ci\u003eK\u003c/i\u003e times"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e8 2\r\n1\r\n2\r\n3\r\n2\r\n3\r\n2\r\n3\r\n1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}