{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eYou are given an array A, consisting of N integers.\u003cbr\u003e\u003cbr\u003eYou are also given 2 integers K and L.\u003cbr\u003e\u003cbr\u003eYou must divide the whole array A into exactly K nonempty intervals, such that the length of each interval is not greater than L.\u003cbr\u003e\u003cbr\u003eThe cost of an interval [S, E] is the bitwise XOR sum of all elements of A whose indices are in [S, E].\u003cbr\u003e\u003cbr\u003eThe score of a division is simply the maximum cost of K intervals in the division. You are interested in the best division, which minimizes the score of the division. Since this is too simple for you, the problem is reversed.\u003cbr\u003e\u003cbr\u003eYou know the minimum score: the answer for the original problem is not greater than X. Now you want to know, the maximum value of K.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are several test cases.\u003cbr\u003e\u003cbr\u003eThe first line of the input contains an integer T (1\u0026lt;\u003dT\u0026lt;\u003d20), the number of test cases. Then T test cases follow.\u003cbr\u003e\u003cbr\u003eEach test case starts with 3 integers N, X, L (1\u0026lt;\u003d L\u0026lt;\u003dN\u0026lt;\u003d100000, 0\u0026lt;\u003dX\u0026lt;268435456), which are described above.\u003cbr\u003e\u003cbr\u003eThe next line contains 3 integers A[1], P, Q. All other integers of the array A are generated from these 3 integers in the following rule:\u003cbr\u003e\u003cbr\u003eFor every integer 1\u0026lt;k\u0026lt;\u003dN, A[k] \u003d (A[k-1]*P+Q) mod 268435456.\u003cbr\u003e(0 \u0026lt;\u003d A[1], P, Q \u0026lt; 268435456)\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, you should print a single line containing the answer.\u003cbr\u003e\u003cbr\u003eIf the answer does not exist, just print 0.\u003cbr\u003e"}},{"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\u003e2\r\n3 1 2\r\n1 1 1\r\n3 0 3\r\n1 1 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}