{"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\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e按位或运算取两个相同长度的二进制表示,并对每对对应位执行逻辑或操作。如果两个位都是$$$0$$$,则每个位置的结果为$$$0$$$,否则结果为$$$1$$$。按位或操作在这个问题中以及在诸如C++和Java等编程语言中使用\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e|\u003c/span\u003e\"运算符表示。\u003c/p\u003e\u003cp\u003e要获取$$$x\\,|\\,y$$$的值,请考虑二进制表示中的两个数字(用零填充以使它们的长度相等),然后对应位应用或操作,并将结果以十进制形式返回。例如,$$$10\\,|\\,17$$$的结果为$$$01010\\,|\\,10001$$$ \u003d $$$11011$$$ \u003d $$$27$$$。\u003c/p\u003e\u003cp\u003e给定一个整数数组$$$a$$$。数组$$$a$$$的子数组是数组$$$a$$$的一些整数($$$l,\\,r$$$)的序列,使得$$$1 \\le l \\le r \\le n$$$。\u003c/p\u003e\u003cp\u003e子数组OR定义为该子数组中所有元素的按位OR。形式上,子数组OR为子数组$$$l,\\,r$$$的$$$a_l\\,|\\,a_{l + 1}\\,|\\,\\cdots\\,|\\,a_r$$$。\u003c/p\u003e\u003cp\u003e你的任务是找到给定数组中所有子数组的子数组OR值,并返回其中所有唯一值的数量。你能做到吗?\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$T$$$($$$1 \\le T \\le 5$$$),表示测试用例的数量。\u003c/p\u003e\u003cp\u003e每个测试用例的第一行包含一个整数$$$n$$$($$$1 \\le n \\le 10^5$$$),表示数组$$$a$$$的大小。然后是包含$$$n$$$个整数$$$a_1, \\cdots, a_n$$$($$$0 \\le a_i \\le 10^9$$$)的一行,表示数组$$$a$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,打印一行,包含给定数组中所有子数组的子数组OR值中唯一值的数量。\u003c/p\u003e"}},{"title":"示例1","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\n3\n1 2 3\n3\n2 4 8\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e在第一个测试用例中,给定数组$$$a$$$中有$$$6$$$个子数组。这些子数组的子数组OR计算如下:\u003c/p\u003e\u003col\u003e \u003cli\u003e($$$1,\\,1$$$)$$$\\rightarrow$$$ $$$1$$$。\u003c/li\u003e\u003cli\u003e($$$1,\\,2$$$)$$$\\rightarrow$$$ $$$1\\,|\\,2 \u003d 3$$$。\u003c/li\u003e\u003cli\u003e($$$1,\\,3$$$)$$$\\rightarrow$$$ $$$1\\,|\\,2\\,| 3 \u003d 3$$$。\u003c/li\u003e\u003cli\u003e($$$2,\\,2$$$)$$$\\rightarrow$$$ $$$2$$$。\u003c/li\u003e\u003cli\u003e($$$2,\\,3$$$)$$$\\rightarrow$$$ $$$2\\,|\\,3 \u003d 3$$$。\u003c/li\u003e\u003cli\u003e($$$3,\\,3$$$)$$$\\rightarrow$$$ $$$3$$$。\u003c/li\u003e\u003c/ol\u003e\u003cp\u003e因此,所有子数组中唯一值的数量为$$$3$$$。\u003c/p\u003e"}}]}