{"trustable":true,"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":"\u003cp\u003eYou are given an array $$$a$$$ of $$$n$$$ integers $$$a_1, a_2, a_3, \\ldots, a_n$$$.\u003c/p\u003e\u003cp\u003eYou have to answer $$$q$$$ independent queries, each consisting of two integers $$$l$$$ and $$$r$$$. \u003c/p\u003e\u003cul\u003e \u003cli\u003e Consider the subarray $$$a[l:r]$$$ $$$\u003d$$$ $$$[a_l, a_{l+1}, \\ldots, a_r]$$$. You can apply the following operation to the subarray any number of times (possibly zero)- \u003col\u003e \u003cli\u003e Choose two integers $$$L$$$, $$$R$$$ such that $$$l \\le L \\le R \\le r$$$ and $$$R - L + 1$$$ is \u003cspan class\u003d\"tex-font-style-bf\"\u003eodd\u003c/span\u003e. \u003c/li\u003e\u003cli\u003e Replace each element in the subarray from $$$L$$$ to $$$R$$$ with the \u003cspan class\u003d\"tex-font-style-tt\"\u003eXOR\u003c/span\u003e of the elements in the subarray $$$[L, R]$$$. \u003c/li\u003e\u003c/ol\u003e \u003c/li\u003e\u003cli\u003e The answer to the query is the minimum number of operations required to make all elements of the subarray $$$a[l:r]$$$ equal to $$$0$$$ or $$$-1$$$ if it is impossible to make all of them equal to $$$0$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou can find more details about \u003cspan class\u003d\"tex-font-style-tt\"\u003eXOR\u003c/span\u003e operation \u003ca href\u003d\"https://en.wikipedia.org/wiki/Bitwise_operation#XOR\"\u003ehere\u003c/a\u003e.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \\le n, q \\le 2 \\cdot 10^5)$$$ \u0026nbsp;— the length of the array $$$a$$$ and the number of queries.\u003c/p\u003e\u003cp\u003eThe next line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ $$$(0 \\le a_i \\lt 2^{30})$$$ \u0026nbsp;— the elements of the array $$$a$$$.\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the next $$$q$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ $$$(1 \\le l_i \\le r_i \\le n)$$$ \u0026nbsp;— the description of the $$$i$$$-th query.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each query, output a single integer \u0026nbsp;— the answer to that query.\u003c/p\u003e"}},{"title":"Examples","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\u003e7 6\n3 0 3 3 1 2 3\n3 4\n4 6\n3 7\n5 6\n1 6\n2 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\n1\n1\n-1\n2\n0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the \u003cspan class\u003d\"tex-font-style-bf\"\u003efirst query\u003c/span\u003e, $$$l \u003d 3, r \u003d 4$$$, subarray \u003d $$$[3, 3]$$$. We can apply operation only to the subarrays of length $$$1$$$, which won\u0027t change the array; hence it is impossible to make all elements equal to $$$0$$$.\u003c/p\u003e\u003cp\u003eIn the \u003cspan class\u003d\"tex-font-style-bf\"\u003esecond query\u003c/span\u003e, $$$l \u003d 4, r \u003d 6$$$, subarray \u003d $$$[3, 1, 2]$$$. We can choose the whole subarray $$$(L \u003d 4, R \u003d 6)$$$ and replace all elements by their XOR $$$(3 \\oplus 1 \\oplus 2) \u003d 0$$$, making the subarray $$$[0, 0, 0]$$$.\u003c/p\u003e\u003cp\u003eIn the \u003cspan class\u003d\"tex-font-style-bf\"\u003efifth query\u003c/span\u003e, $$$l \u003d 1, r \u003d 6$$$, subarray \u003d $$$[3, 0, 3, 3, 1, 2]$$$. We can make the operations as follows: \u003c/p\u003e\u003col\u003e \u003cli\u003e Choose $$$L \u003d 4, R \u003d 6$$$, making the subarray $$$[3, 0, 3, 0, 0, 0]$$$. \u003c/li\u003e\u003cli\u003e Choose $$$L \u003d 1, R \u003d 5$$$, making the subarray $$$[0, 0, 0, 0, 0, 0]$$$. \u003c/li\u003e\u003c/ol\u003e"}}]}