{"id":324859,"date":"2021-06-13T21:00:24","date_gmt":"2021-06-13T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=324859"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=324859","title":{"rendered":"MEX (Minimum EXcluded) \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 MEX (\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435).<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x6\/1m\/7z\/x61m7zgyydwplhndgxpl6o0iwoq.png\"><\/div>\n<p>  \u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 cat<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430 \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u0437\u044f\u043b\u0441\u044f? <br \/>  \u0412\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u043d\u0430 OZON.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yg\/xh\/d5\/ygxhd5gczbfvqldz_8wsyegql7y.png\"><\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0437\u0430\u0434\u0430\u0447\u0438, \u0432 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 MEX \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0447\u0438\u0441\u0435\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0439. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00abMEX\u00bb \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u00abMinimum EXcluded\u00bb \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x6\/1m\/7z\/x61m7zgyydwplhndgxpl6o0iwoq.png\"><\/div>\n<p>  \u0418 \u043f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0432 \u0441\u0435\u0442\u0438, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0435\u0442 \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f MEX\u2026 <\/p>\n<p>  \u0415\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043b\u043e\u0431, \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0433\u0440\u0430\u0444\u0430\u043c\u0438, \u043d\u043e, \u043a\u0430\u043a-\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0441\u043a\u0438\u0434\u0430\u043d\u043e \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0443\u0433\u043b\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0438 \u043d\u0435\u0442 \u0435\u0434\u0438\u043d\u043e\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443. \u0412\u043e\u0442 \u0438 \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f MEX \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u041a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C#, \u043d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u0442\u0430\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439.<\/p>\n<p>  \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c.<\/p>\n<pre><code class=\"cs\">static void Main(string[] args)         {             \/\/MEX = 2             int[] values = new[] { 0, 12, 4, 7, 1 };                          \/\/MEX = 5             \/\/int[] values = new[] { 0, 1, 2, 3, 4 };                          \/\/MEX = 24             \/\/int[] values = new[] { 11, 10, 9, 8, 15, 14, 13, 12, 3, 2, 0, 7, 6, 5, 27, 26, 25, 4, 31, 30, 28, 19, 18, 17, 16, 23, 22, 21, 20, 43, 1, 40, 47, 46, 45, 44, 35, 33, 32, 39, 38, 37, 36, 58, 57, 56, 63, 62, 60, 51, 49, 48, 55, 53, 52, 75, 73, 72, 79, 77, 67, 66, 65, 71, 70, 68, 90, 89, 88, 95, 94, 93, 92, 83, 82, 81, 80, 87, 86, 84, 107, 106, 104 };                          \/\/MEX = 1000             \/\/int[] values = new int[1000];             \/\/for (int i = 0; i &lt; values.Length; i++) values[i] = i;                          \/\/\u0418\u043c\u043f\u0440\u043e\u0432\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439             int total = 0;             int mex = GetMEX(values, ref total);             Console.WriteLine($&quot;mex: {mex}, total: {total}&quot;);             Console.ReadKey();         }<\/code><\/pre>\n<p>  \u0418 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0447\u0430\u0441\u0442\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e \u0441\u043b\u043e\u0432\u043e \u00ab\u043c\u0430\u0441\u0441\u0438\u0432\u00bb, \u0445\u043e\u0442\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u00ab\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u00bb, \u0442\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0445\u043e\u0447\u0443 \u0438\u0437\u0432\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c\u0438, \u043a\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0437\u0430\u0442\u044c \u0441\u043b\u0443\u0445 \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>  <i><u>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 1 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432<\/u>: \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u0438\u0434\u0440\u0430\u043b\u0438\u0441\u044c \u043a O(n), \u043c\u043e\u043b \u0432\u0441\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b O(n) \u0438 \u043f\u043e \u0444\u0438\u0433\u0443, \u0447\u0442\u043e \u00abO\u00bb \u0432\u0435\u0437\u0434\u0435 \u0440\u0430\u0437\u043d\u043e\u0435 \u0438 \u043d\u0435 \u0434\u0430\u0451\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0422\u043e \u0434\u043b\u044f \u0434\u0443\u0448\u0435\u0432\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c O \u043d\u0430 T. \u0413\u0434\u0435 T \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f: \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435. \u0422\u0430\u043a, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0432\u0441\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0449\u0435<\/i><\/p>\n<p>  <i><u>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 2 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432<\/u>: \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <b>\u041d\u0415<\/b>\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u043e\u0435. \u0418\u0431\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u2014 \u0442\u043e\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/i><\/p>\n<h2>1) \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043b\u043e\u0431<\/h2>\n<p>  \u041a\u0430\u043a \u043d\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u00ab\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0447\u0438\u0441\u043b\u043e\u00bb? \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2013 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0432\u043d\u043e\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0443.<\/p>\n<pre><code class=\"cs\">  static int GetMEX(int[] values, ref int total)         {             for (int mex = 0; mex &lt; values.Length; mex++)             {                 bool notFound = true;                 for (int i = 0; i &lt; values.Length; i++)                 {                     total++;                     if (values[i] == mex)                     {                         notFound = false;                         break;                     }                 }                 if (notFound)                 {                     return mex;                 }             }             return values.Length;         }     }<\/code><\/pre>\n<p>  \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 T(n*cell(n\/2))\u2026 \u0422.\u043a. \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 1, 2, 3, 4 } \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u0442.\u043a. \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c 15 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0410 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0438\u0437 100 \u0447\u0438\u0441\u043b\u0435 5050 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439\u2026 \u0422\u0430\u043a \u0441\u0435\u0431\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h2>2) \u041f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 T(n)\u2026 \u041d\u0443 \u0438\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 T(n), \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0445\u0438\u0442\u0440\u044f\u0442 \u0438 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\u2026 \u0418\u0431\u043e, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u2014 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435.<\/p>\n<p>  \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a.<\/p>\n<p>  \u0411\u0435\u0440\u0435\u0442\u0441\u044f \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 S \u0434\u043b\u0438\u043d\u043d\u043e\u0439 m (\u0433\u0434\u0435 m \u2013 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 V) \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 0. \u0418 \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 (V) \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 (S) \u0441\u0442\u0430\u0432\u044f\u0442\u0441\u044f 1. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0445\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0443\u0441\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0412\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 m \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442.\u043a. \u0435\u0441\u043b\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u00ab\u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442\u00bb \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043e m, \u0442\u043e \u044f\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u043b\u0438\u043d\u044b m.<\/p>\n<pre><code class=\"cs\">static int GetMEX(int[] values, ref int total)         {             bool[] sieve = new bool[values.Length];             for (int i = 0; i &lt; values.Length; i++)             {                 total++;                 var intdex = values[i];                 if (intdex &lt; values.Length)                 {                     sieve[intdex] = true;                 }             }             for (int i = 0; i &lt; sieve.Length; i++)             {                 total++;                 if (!sieve[i])                 {                     return i;                 }             }             return values.Length;         } <\/code><\/pre>\n<p>  \u0422.\u043a. \u00ab\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438\u00bb \u2013 \u0445\u0438\u0442\u0440\u044b\u0435 \u043b\u044e\u0434\u0438. \u0422\u043e \u043e\u043d\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c T(n) \u0432\u0435\u0434\u044c \u043f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d\u2026 <\/p>\n<p>  \u0412\u043e\u0442 \u0441\u0438\u0434\u044f\u0442 \u0438 \u0440\u0430\u0434\u0443\u044e\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u0440\u0443\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438, \u043d\u043e \u043f\u0440\u0430\u0432\u0434\u0430 \u0442\u0430\u043a\u043e\u0432\u0430.<br \/>  \u041f\u0435\u0440\u0432\u043e\u0435 \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0438 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 S T1(n)<br \/>  \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 S \u0438 \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u043f\u0430\u0432\u0448\u0435\u044e\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 T2(n)<br \/>  \u0418\u0442\u043e\u0433\u043e, \u0442.\u043a. \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u044b \u0434\u043e T(n*2)<\/p>\n<p>  \u041d\u043e \u044d\u0442\u043e \u044f\u0432\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043b\u043e\u0431\u2026 \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0430 \u043d\u0430\u0448\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 12, 4, 7, 1 }: <i>\u0412 \u043b\u043e\u0431<\/i>: 11 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 8 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 1, 2, 3, 4 }: <i>\u0412 \u043b\u043e\u0431<\/i>: 15 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 10 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 11,\u2026}: <i>\u0412 \u043b\u043e\u0431<\/i>: 441 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 108 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0,\u2026,999}: <i>\u0412 \u043b\u043e\u0431<\/i>: 500500 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 2000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<\/ol>\n<p>  \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u00ab\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c, \u0442\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043b\u043e\u0431 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0442.\u043a. \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u0440\u043e\u0439\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443. \u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c, \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u0445 \u044f\u0432\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u044c\u044e, \u0447\u0442\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<br \/>  \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u00ab\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430\u00bb \u2013 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u043e\u0442\u043e\u0432, \u0438 \u043e\u043d \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u0435\u043d, \u043d\u043e \u0432\u043e\u0442 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u00ab\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u00bb \u2013 \u043e\u043d \u0443\u0436\u0430\u0441\u0435\u043d \u0438\u0437-\u0437\u0430 \u043e\u0431\u044a\u0435\u043c\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u043f\u0443\u0441\u0442\u0443\u044e, \u0434\u0430 \u0438 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044f\u0432\u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e, \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434.<\/p>\n<pre><code class=\"cs\">static int GetMEX(int[] values, ref int total)         {             var max = values.Length;             var size = sizeof(ulong) * 8;             ulong[] sieve = new ulong[(max \/ size) + 1];             ulong one = 1;             for (int i = 0; i &lt; values.Length; i++)             {                 total++;                 var intdex = values[i];                 if (intdex &lt; values.Length)                 {                     sieve[values[i] \/ size] |= (one &lt;&lt; (values[i] % size));                 }             }              var maxInblock = ulong.MaxValue;             for (int i = 0; i &lt; sieve.Length; i++)             {                 total++;                 if (sieve[i] != maxInblock)                 {                     total--;                     for (int j = 0; j &lt; size; j++)                     {                         total++;                         if ((sieve[i] &amp; (one &lt;&lt; j)) == 0)                         {                             return i * size + j;                         }                     }                 }             }             return values.Length;         }<\/code><\/pre>\n<p>  \u0427\u0442\u043e \u043c\u044b \u0442\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0432 64 \u0440\u0430\u0437\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430.<\/p>\n<pre><code class=\"cs\">var size = sizeof(ulong) * 8; ulong[] sieve = new ulong[(max \/ size) + 1]; <\/code><\/pre>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0444\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443: \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u0431\u043b\u043e\u043a \u043d\u0430 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u044b\u0445 64 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: <i>if (sieve[i] != maxInblock)<\/i> \u0438 \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430 \u0438\u0449\u0435\u043c \u0443\u0436\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0431\u043b\u043e\u043a\u0430: <i>((sieve[i] &amp; (one &lt;&lt; j)) == 0<\/i><\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u043c \u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 12, 4, 7, 1 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 8 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 8 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 1, 2, 3, 4 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 10 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 11 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li> \u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 11,\u2026}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 108 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 108 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0,\u2026,999}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>: 2000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 1056 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<\/ol>\n<p>  \u0422\u0430\u043a, \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438?<\/p>\n<p>  T(n*3) \u043c\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438 \u0432 T(n*2) + T(n \/ 64) \u0432 \u0446\u0435\u043b\u043e\u043c, \u0447\u0443\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0434\u0430 \u0435\u0449\u0435 \u043e\u0431\u044a\u0451\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0438 \u0430\u0436 \u0432 64 \u0440\u0430\u0437\u0430. \u0427\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e)<\/p>\n<h2>3) \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/h2>\n<p>  \u041a\u0430\u043a \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u2013 \u044d\u0442\u043e \u0438\u043c\u0435\u0442\u044c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e.<\/p>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u2014 \u044d\u0442\u043e \u00abquicksort\u00bb (\u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 T1(n log(n)). \u0418 \u0438\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 MEX \u0432 T1(n log(n)) + T2(n)<\/p>\n<pre><code class=\"cs\">static int GetMEX(int[] values, ref int total)         {             total = values.Length * (int)Math.Log(values.Length);             values = values.OrderBy(x =&gt; x).ToArray();             for (int i = 0; i &lt; values.Length - 1; i++)             {                 total++;                 if (values[i] + 1 != values[i + 1])                 {                     return values[i] + 1;                 }             }             return values.Length;         }<\/code><\/pre>\n<p>  \u0428\u0438\u043a\u0430\u0440\u043d\u043e. \u041d\u0438\u0447\u0435\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e.<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 12, 4, 7, 1 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 8, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: ~7 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 1, 2, 3, 4 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 11 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: ~9 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 11,\u2026}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 108 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: ~356 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0,\u2026,999}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 1056 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: ~6999 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<\/ol>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438 \u043e\u043d\u0438 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b. \u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c: \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u2014 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u044f\u0432\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u0432 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0435.<br \/>  <i><u>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/u>: values.OrderBy(x =&gt; x).ToArray() \u2013 \u0434\u0430 \u044f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u0443\u0442 \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0430\u0441\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u043e \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e \u0443\u043c\u0443, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432, \u0430 \u043d\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e\u2026<br \/>  <\/i><\/p>\n<p>  \u0412\u043e\u0442 \u0443 \u043c\u0435\u043d\u044f \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c quicksort \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 MEX. \u0414\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u044f \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u043d\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u0438 \u0443\u0436 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u043e \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0441 0 \u043f\u043e \u0434\u043e\u0440\u043e\u0433\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u044f \u043a\u0430\u043a \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \ud83d\ude00 <\/p>\n<p>  \u041d\u043e, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 quicksort. \u042f \u0431\u044b \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u0430\u043b, \u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f quicksort \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442\u0443, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u044b \u043f\u043e\u0441\u043e\u0431\u0438\u0439 \u0441\u0430\u043c\u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043f\u043e\u043a\u0430 \u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u043e \u043d\u0435\u0433\u043e\u2026<\/p>\n<p>  \u0422\u0430\u043a \u0432\u043e\u0442, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 quicksort:<br \/>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 { 0, 12, 4, 7, 1 }<br \/>  \u041d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u00ab\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00bb, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0437\u044f\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u2014 \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u043e\u0440\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e (T).<\/p>\n<p>  \u0418 \u0434\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f: L1 \u2013 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, L2 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  0, 12, 4, 7, 1<br \/>  L1 = 0, L2 = 1, T = 1 (T \u0432\u0437\u044f\u043b \u0442\u0443\u043f\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435)<\/p>\n<p>  <b>\u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438<\/b>:<br \/>  \u041f\u043e\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c L1<br \/>  \u0421\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0435\u0433\u043e \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0432\u043f\u0440\u0430\u0432\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043d\u0430\u0448\u0435 \u043e\u043f\u043e\u0440\u043d\u043e\u0435.<br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 L1 \u0440\u0430\u0432\u0435\u043d 8<\/p>\n<p>  <b>\u0412\u0442\u043e\u0440\u043e\u0439 \u044d\u0442\u0430\u043f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438<\/b>:<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c L2<br \/>  \u0421\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0435\u0433\u043e \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0432\u043b\u0435\u0432\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0438\u0431\u043e \u0440\u0430\u0432\u043d\u043e\u0435 \u0447\u0435\u043c \u043d\u0430\u0448\u0435 \u043e\u043f\u043e\u0440\u043d\u043e\u0435.<br \/>  <i>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 L2 \u0440\u0430\u0432\u0435\u043d 1. \u0422.\u043a. \u044f \u0432\u0437\u044f\u043b \u043e\u043f\u043e\u0440\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0432\u043d\u044b\u043c \u043a\u0440\u0430\u0439\u043d\u0435\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u0442\u0443\u0434\u0430 \u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b L2.<\/i><\/p>\n<p>  <b>\u0422\u0440\u0435\u0442\u0435\u0439 \u044d\u0442\u0430\u043f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438<\/b>:<br \/>  \u041c\u0435\u043d\u044f\u0435\u043c \u0447\u0438\u0441\u043b\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u0445 L1 \u0438 L2 \u043c\u0435\u0441\u0442\u0430\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0435 \u0434\u0432\u0438\u0433\u0430\u0435\u043c.<br \/>  \u0418 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.<br \/>  \u042d\u0442\u0438 \u044d\u0442\u0430\u043f\u044b \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 L1 \u0438 L2 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044b, \u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043d\u0438\u043c, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438. \u0422.\u0435. \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0441\u043e\u0439\u0434\u0443\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435, \u043e\u0431\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0451 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043d\u043e \u0443\u0436\u0435 \u0442\u043e\u0447\u043d\u043e, \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u00ab\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 (L1 \u0438 L2)\u00bb \u0431\u0443\u0434\u0443\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 T, \u0430 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 T. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u043d\u0430\u043c \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0434\u0432\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\u0445.<\/p>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%91%D1%8B%D1%81%D1%82%D1%80%D0%B0%D1%8F_%D1%81%D0%BE%D1%80%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%BA%D0%B0\" rel=\"nofollow noopener noreferrer\">\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430 wiki, \u0435\u0441\u043b\u0438 \u0438 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e<\/a><\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c Quicksort<\/p>\n<pre><code class=\"cs\">static void Quicksort(int[] values, int l1, int l2, int t, ref int total)         {             var index = QuicksortSub(values, l1, l2, t, ref total);             if (l1 &lt; index)             {                 Quicksort(values, l1, index - 1, values[index - 1], ref total);             }             if (index &lt; l2)             {                 Quicksort(values, index, l2, values[l2], ref total);             }         }          static int QuicksortSub(int[] values, int l1, int l2, int t, ref int total)         {             for (; l1 &lt; l2; l1++)             {                 total++;                 if (t &lt; values[l1])                 {                     total--;                     for (; l1 &lt;= l2; l2--)                     {                         total++;                         if (l1 == l2)                         {                             return l2;                         }                         if (values[l2] &lt;= t)                         {                             values[l1] = values[l1] ^ values[l2];                             values[l2] = values[l1] ^ values[l2];                             values[l1] = values[l1] ^ values[l2];                             break;                         }                     }                 }             }             return l2;         }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439:<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 12, 4, 7, 1 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 13, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: 11 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 1, 2, 3, 4 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 16 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: 14 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 11,\u2026}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 191 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: 1520 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0,\u2026,999}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 2056 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/i>: 500499 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<\/ol>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u0442\u044c \u0432\u043e\u0442 \u043d\u0430\u0434 \u0447\u0435\u043c. \u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 { 0, 4, 1, 2, 3 } \u043d\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0430 \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0430 \u0440\u0430\u0432\u043d\u043e 5. \u0422.\u0435. \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0432\u0435\u043d \u0434\u043b\u0438\u043d\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u2014 1. \u0422.\u0435. m = { 0, 4, 1, 2, 3 }, Length(m) == Max(m) + 1. \u0418 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438. \u0418 \u0432\u0430\u0436\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a: <br \/>  { 0, 4, 1, 2, 3, 12, 10, 11, 14 } \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u0432 \u043b\u0435\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0435\u043a\u043e\u0433\u043e \u043e\u043f\u043e\u0440\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 5, \u0430 \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u0432\u0441\u0451 \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u043e \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0438\u0441\u043a\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u043b\u0435\u0432\u0430.<\/p>\n<p>  \u0422.\u0435. \u0435\u0441\u043b\u0438 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0447\u0430\u0441\u0442\u0435\u0439 \u043d\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u043e \u0441\u0430\u043c\u043e \u044d\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0447\u0438\u0441\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412 \u0446\u0435\u043b\u043e\u043c \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043c\u0435\u043d\u044f \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043c\u044b\u0441\u043b\u044c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c quicksort \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 MEX \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0432 \u0435\u0433\u043e \u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u043c. \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0447\u0430\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u0434<\/p>\n<pre><code class=\"cs\">static int GetMEX(int[] values, ref int total)         {             return QuicksortMEX(values, 0, values.Length - 1, values[values.Length - 1], ref total);         }          static int QuicksortMEX(int[] values, int l1, int l2, int t, ref int total)         {             if (l1 == l2)             {                 return l1;             }             int max = -1;             var index = QuicksortMEXSub(values, l1, l2, t, ref max, ref total);             if (index &lt; max + 1)             {                 return QuicksortMEX(values, l1, index - 1, values[index - 1], ref total);             }             if (index == values.Length - 1)             {                 return index + 1;             }             return QuicksortMEX(values, index, l2, values[l2], ref total);         }          static int QuicksortMEXSub(int[] values, int l1, int l2, int t, ref int max, ref int total)         {             for (; l1 &lt; l2; l1++)             {                 total++;                 if (values[l1] &lt; t &amp;&amp; max &lt; values[l1])                 {                     max = values[l1];                 }                 if (t &lt; values[l1])                 {                     total--;                     for (; l1 &lt;= l2; l2--)                     {                         total++;                         if (values[l2] == t &amp;&amp; max &lt; values[l2])                         {                             max = values[l2];                         }                         if (l1 == l2)                         {                             return l2;                         }                         if (values[l2] &lt;= t)                         {                             values[l1] = values[l1] ^ values[l2];                             values[l2] = values[l1] ^ values[l2];                             values[l1] = values[l1] ^ values[l2];                             break;                         }                     }                 }             }             return l2;         }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 12, 4, 7, 1 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 13, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 MEX<\/i>: 8 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0, 1, 2, 3, 4 }: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 16 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 MEX<\/i>: 4 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 11,\u2026}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 191 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 MEX<\/i>: 1353 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<li>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f { 0,\u2026,999}: <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/i>: 2056 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, <i>\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 MEX<\/i>: 999 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<\/ol>\n<p>  <\/p>\n<h2>\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>  \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0440\u0430\u0437\u043d\u044b \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0438\u0441\u043a\u0430 MEX. \u041a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043b\u0443\u0447\u0448\u0435 \u2014 \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u0430\u043c.<\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c. \u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0445 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f <i>\u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u0435<\/i>, \u0438 \u0432\u043e\u0442 \u043f\u043e \u043a\u0430\u043a\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c:<br \/>  \u0423 \u043d\u0435\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0422.\u0435. \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0438 \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435:<\/p>\n<pre><code class=\"cs\">for (int i = minIndexThread; i &lt; maxIndexThread; i++) sieve[values[i] \/ size] |= (one &lt;&lt; (values[i] % size)); <\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u043d\u0443\u0436\u0435\u043d lock \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 <i>sieve[values[i] \/ size]<\/i>. \u0418 \u0435\u0449\u0435 \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u0434\u0435\u0430\u043b\u0435\u043d \u043f\u0440\u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u043e\u0436\u043d\u043e \u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0430\u0447\u043a\u0430\u043c\u0438 \u043f\u043e 1000 \u0448\u0442\u0443\u043a \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  \u041d\u043e \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0441\u0442\u0440\u043e\u0433\u0430\u044f \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438, \u0442\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 MEX \u2013 \u044f\u0432\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0443\u0447\u0448\u0435.<\/p>\n<h4>P.S.<\/h4>\n<p>  \u042f \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u0441 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u0430 \u043d\u0430 OZON \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b, \u0441\u0434\u0435\u043b\u0430\u0432 \u00ab\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u00bb \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u043e\u0441\u0435\u0438\u0432\u0430\u043d\u044c\u044f, \u043f\u0440\u0438\u0437 \u0437\u0430 \u043d\u0435\u0433\u043e \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b, OZON \u0441\u0447\u0435\u043b \u0435\u0433\u043e \u043d\u0435\u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u2026 \u041f\u043e \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0447\u0438\u043d \u2014 \u043e\u043d \u0442\u0430\u043a \u0438 \u043d\u0435 \u0441\u043e\u0437\u043d\u0430\u043b\u0441\u044f\u2026 \u0414\u043e \u0438 \u043a\u043e\u0434\u0430 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044f \u044f \u043d\u0435 \u0432\u0438\u0434\u0435\u043b. \u041c\u043e\u0436\u0435\u0442 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 MEX \u043b\u0443\u0447\u0448\u0435?<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/562594\/\"> https:\/\/habr.com\/ru\/post\/562594\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 MEX (\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435).<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x6\/1m\/7z\/x61m7zgyydwplhndgxpl6o0iwoq.png\"><\/div>\n<p>  \u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u0440\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  \u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 cat  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-324859","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324859"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324859\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}