{"id":343,"date":"2015-11-04T19:10:06","date_gmt":"2015-11-04T16:10:06","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=343"},"modified":"2016-06-29T18:13:38","modified_gmt":"2016-06-29T15:13:38","slug":"bitsegmentedarray","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=343","title":{"rendered":"BitSegmentedArray"},"content":{"rendered":"<p>\u041c\u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 SegmentedArray \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<ul>\n<li>\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432<\/li>\n<li>\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &#8212; 0 \u0438 1<\/li>\n<li>\u0447\u0430\u0441\u0442\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b get() \u0438 set()<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u044f \u0440\u0435\u0448\u0438\u043b\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u043e\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &#8212; \u044d\u0442\u043e 0 \u0438 1, \u0438 \u043b\u044e\u0431\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0435\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 long, \u0432 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0434\u043e 64 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a \u0431\u044b\u043b\u0430 \u0440\u0435\u0448\u0435\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0418\u0437-\u0437\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c \u043a\u043e\u0434\u0435, \u043a \u043d\u0438\u043c \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 get() \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0441\u0434\u0432\u0438\u0433 \u0438 \u0431\u0438\u0442\u043e\u0432\u043e\u0435 &#171;\u0438&#187;. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u041e(1).<\/p>\n<p>\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 set() \u043c\u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u0430 \u0431\u043b\u043e\u0447\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 (64 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 1 \u044f\u0447\u0435\u0439\u043a\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430). \u0410 \u0438\u043c\u0435\u043d\u043d\u043e: \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0440\u0435\u0437\u043a\u0430, \u0430 \u044f\u0447\u0435\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435: 0 &#8212; \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044f\u0447\u0435\u0439\u043a\u0438 \u043d\u0443\u043b\u0438, -1 &#8212; \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044f\u0447\u0435\u0439\u043a\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u044b.<\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 add().<\/p>\n<p>\u0421 \u043c\u0435\u0442\u043e\u0434\u043e\u043c min() \u0432\u0441\u0451 \u0438 \u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435: \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u0441\u043b\u0443\u0436\u0438\u0442 \u043b\u0438\u0431\u043e 0, \u043b\u0438\u0431\u043e 1. \u041f\u0435\u0440\u0432\u044b\u0439 \u0436\u0435 \u043d\u043e\u043b\u044c, \u0432\u0441\u0442\u0440\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u0440\u0435\u0437\u043a\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0430, \u0447\u0442\u043e, \u043a\u0430\u043a \u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u043e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u044b. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 get(), set(), add() \u0438 min() \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u0430 \u043b\u0438\u0448\u044c \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u0432 \u043d\u0451\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u043b\u044f.<\/p>\n<p>\u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<ul>\n<li>get(i): O(1);<\/li>\n<li>set(x, y, val): O((y-x)\/64);<\/li>\n<li>add(x, y, val): O((y-x)\/64) &#8212; \u0434\u043b\u044f val%2==1, \u0438 O(1) &#8212; \u0434\u043b\u044f val%2==0;<\/li>\n<li>min(x, y) &#8212; O((x-y)\/64) &#8212; \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 (\u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0435 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0443\u043b\u0438), O(1) &#8212; \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 (\u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0435 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0435\u0434\u0438\u043d\u0438\u0446\u044b).<\/li>\n<\/ul>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<pre class=\"lang:java decode:true \">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\ninterface SegmentedArray {\r\n\tlong size(); \/\/ &lt;= 2^31 - 1\r\n\tlong get(long index);\r\n\tSegmentedArray set(int start, int end, long value); \/\/ [start, end) &lt;- value % 2\r\n\tSegmentedArray add(int start, int end, long value); \/\/ [start, end) += value % 2\r\n\tint min(int start, int end); \/\/ [start, end)\r\n}\r\n\r\nclass BitSegmentedArray implements SegmentedArray {\r\n\tlong size;\r\n\tlong realSize;\r\n\tlong []storage;\r\n\tpublic BitSegmentedArray(long size) {\r\n\t\tthis.size = size;\r\n\t\tif (size%64!=0) this.realSize = size\/64 + 1;\r\n\t\telse this.realSize = size\/64;\r\n\t\tstorage = new long [(int)realSize];\r\n\t\tfor (int i = 0; i &lt; realSize; i++) {\r\n\t\t\tstorage[i] = 0;\r\n\t\t}\r\n\t}\r\n\tpublic long size() {\r\n\t\treturn size;\r\n\t}\r\n\tpublic long get(long index) {\r\n\t\tindex--;\r\n\t\treturn storage[(int)index\/64] &gt;&gt; (index%64) &amp; 1;\r\n\t}\r\n\tpublic void print() {\r\n\t\tfor (int i = 0; i &lt; this.realSize; i++) {\r\n\t\t\tfor (int j = 0; j &lt; 64; j++) {\r\n\t\t\t\tSystem.out.print(this.storage[i] &gt;&gt; j &amp; 1);\r\n\t\t\t\tSystem.out.print(\" \");\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}\r\n\tpublic SegmentedArray set(int start, int end, long value) {\r\n\t\tstart--;\r\n\t\tend--;\r\n\t\tint realStart = start\/64;\r\n\t\tint realEnd = end\/64;\r\n\t\tif (realStart != realEnd) {\r\n\t\t\tfor (int i = start%64; i &lt; 64; i++) {\r\n\t\t\t\tif (value%2 == 1) storage[realStart] |= (value&amp;1) &lt;&lt; i;\r\n\t\t\t\telse if (this.get(i+1) == 1) storage[realStart] ^= ((long)1 &lt;&lt; i);\r\n\t\t\t}\r\n\t\t\tfor (int i = realStart + 1; i &lt; realEnd; i++) {\r\n\t\t\t\tif (value%2 == 0) storage[i] = 0;\r\n\t\t\t\telse storage[i] = -1;\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i &lt; end%64; i++) {\r\n\t\t\t\tif (value%2 == 1) storage[realEnd] |= (value&amp;1) &lt;&lt; i;\r\n\t\t\t\telse if (this.get(i+1) == 1) storage[realEnd] ^= ((long)1 &lt;&lt; i);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor (int i = start%64; i &lt; end%64; i++) {\r\n\t\t\t\tif (value%2 == 1) storage[realStart] |= (value&amp;1) &lt;&lt; i;\r\n\t\t\t\telse if (this.get(i+1) == 1) storage[realStart] ^= ((long)1 &lt;&lt; i);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t} \r\n\tpublic SegmentedArray add(int start, int end, long value) {\r\n\t\tif (value % 2 == 0) return this;\r\n\t\tstart--;\r\n\t\tend--;\r\n\t\tint realStart = start\/64;\r\n\t\tint realEnd = end\/64;\r\n\t\tif (realStart != realEnd) {\r\n\t\t\tfor (int i = start%64; i &lt; 64; i++) {\r\n\t\t\t\tstorage[realStart] ^= (value&amp;1) &lt;&lt; i;\r\n\t\t\t}\r\n\t\t\tfor (int i = realStart + 1; i &lt; realEnd; i++) {\r\n\t\t\t\tif (storage[i] == 0) storage[i] = -1;\r\n\t\t\t\telse storage[i] = 0;\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i &lt; end%64; i++) {\r\n\t\t\t\tstorage[realEnd] ^= (value&amp;1) &lt;&lt; i;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor (int i = start%64; i &lt; end%64; i++) {\r\n\t\t\t\tstorage[realStart] ^= (value&amp;1) &lt;&lt; i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\tpublic int min(int start, int end) {\r\n\t\tstart--;\r\n\t\tend--;\r\n\t\tint realStart = start\/64;\r\n\t\tint realEnd = end\/64;\r\n\t\tif (realStart != realEnd) {\r\n\t\t\tfor (int i = start%64; i &lt; 64; i++) {\r\n\t\t\t\tlong tmp = (storage[realStart] &gt;&gt; i) &amp; 1;\r\n\t\t\t\tif (tmp != 1) return 0;\r\n\t\t\t}\r\n\t\t\tfor (int i = realStart + 1; i &lt; realEnd; i++) {\r\n\t\t\t\tif (storage[i] != -1) return 0;\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i &lt; end%64; i++) {\r\n\t\t\t\tlong tmp = (storage[realEnd] &gt;&gt; i) &amp; 1;\r\n\t\t\t\tif (tmp != 1) return 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor (int i = start%64; i &lt; end%64; i++) {\r\n\t\t\t\tlong tmp = (storage[realStart] &gt;&gt; i) &amp; 1;\r\n\t\t\t\tif (tmp != 1) return 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn 1;\r\n\t}\r\n\tpublic static void main(String[] args)\t{\r\n\t\tBitSegmentedArray b = new BitSegmentedArray (10000);\r\n\t\tlong start, end;\r\n\t\tstart = System.nanoTime();\r\n\t\tb.set(50, 4566, 1);\r\n\t\tend = System.nanoTime();\r\n\t\tSystem.out.println(\"Set \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 \" + (end - start) + \" \u043d\u0441.\");\r\n\t\tb.set(130, 740, 0);\r\n\t\tb.set(1000, 1084, 0);\r\n\t\tb.set(3006, 3070, 0);\r\n\t\t\r\n\t\tstart = System.nanoTime();\r\n\t\tlong get = b.get(111);\r\n\t\tend = System.nanoTime();\r\n\t\tSystem.out.println(\"Get \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 \" + (end - start) + \" \u043d\u0441.\");\r\n\t\tSystem.out.println(get);\r\n\t\t\r\n\t\tstart = System.nanoTime();\r\n\t\tb.add(76, 830, 1);\r\n\t\tend = System.nanoTime();\r\n\t\tSystem.out.println(\"Add \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 \" + (end - start) + \" \u043d\u0441.\");\r\n\t\tb.add(60, 92, 0);\r\n\t\t\r\n\t\tstart = System.nanoTime();\r\n\t\tint minimum = b.min(130, 1400);\r\n\t\tend = System.nanoTime();\r\n\t\tSystem.out.println(\"Min \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 \" + (end - start) + \" \u043d\u0441.\");\r\n\t\tSystem.out.println(minimum);\r\n\t}\r\n}<\/pre>\n<p>\u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/ideone.com\/3kaV1d\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430: <a href=\"http:\/\/ideone.com\/T8obvl\">SimpleSegmentedArray<\/a>.<\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<pre class=\"\">Set \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 25626 \u043d\u0441.\r\nGet \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 717 \u043d\u0441.\r\n1\r\nAdd \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 16785 \u043d\u0441.\r\nMin \u0432 BitSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 6521 \u043d\u0441.\r\n0<\/pre>\n<pre class=\"\">Set \u0432 SimpleSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 200334 \u043d\u0441.\r\nGet \u0432 SimpleSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 10362 \u043d\u0441.\r\n1\r\nAdd \u0432 SimpleSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 43084 \u043d\u0441.\r\nMin \u0432 SimpleSegmentedArray \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430 52949 \u043d\u0441.\r\n0<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041c\u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 SegmentedArray \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &#8212; 0 \u0438 1 \u0447\u0430\u0441\u0442\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b get() \u0438 set() \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u044f \u0440\u0435\u0448\u0438\u043b\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u043e\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 &#8212; \u044d\u0442\u043e 0 \u0438 1, \u0438 \u043b\u044e\u0431\u043e\u0435 \u0447\u0438\u0441\u043b\u043e &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=343\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[42,43],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/343"}],"collection":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343"}],"version-history":[{"count":7,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":469,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions\/469"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}