{"id":446638,"date":"2025-01-31T21:00:06","date_gmt":"2025-01-31T21:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=446638"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-01-31T21:00:06","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=446638","title":{"rendered":"<span>\u0421\u0443\u0434\u043e\u043a\u0443: \u043c\u043e\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432 \u043d\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0427\u0430\u0441\u0442\u044c 1 (\u043d\u0430\u0434\u0435\u044e\u0441\u044c)\u2026<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0439 NP-\u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 &#8212; \u044d\u0442\u043e \u0446\u0435\u043b\u044c \u0430\u043c\u0431\u0438\u0446\u0438\u043e\u0437\u043d\u0430\u044f, \u043f\u0430\u0445\u043d\u0443\u0449\u0430\u044f \u0441\u043b\u0430\u0432\u043e\u0439 \u0438 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u043c\u0438 \u0434\u0435\u043d\u044c\u0433\u0430\u043c\u0438. \u041a\u0430\u043a \u0440\u0430\u0437 \u043a \u0442\u0430\u043a\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0421\u0443\u0434\u043e\u043a\u0443, \u0438 \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0432\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438 \u044f \u0433\u043e\u0440\u0435\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u0430 (\u043f\u043e \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f\u043c) \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u0435\u043b\u0430, \u0438 \u0445\u043e\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438 \u0432\u044b\u0448\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f-\u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e) &#8212; \u0434\u0435\u043b\u043e \u0435\u0449\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f, \u0442.\u043a. \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043d\u0430\u0441\u0442\u0430\u043b &#171;\u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0438\u0439 \u0442\u0443\u043f\u0438\u043a&#187;. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0438 \u043d\u0430 \u0441\u0432\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u044b\u043b\u0438\u0437\u0430\u043d\u044b + \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 Java, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0430 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u044f\u0437\u044b\u043a \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0441 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0431\u0435\u0434\u043e\u0439 \u043d\u0430 Java. \u041f\u043e\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0432\u0430\u0440\u0438\u0432\u0430\u0435\u0442\u0435 Java \u0438 \u0432\u0441\u044f\u043a\u0438\u0435 \u0442\u0430\u043c \u0441\u0442\u0440\u0438\u043c\u044b &#8212; \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442.<\/p>\n<p>\u041f\u0438\u0448\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0442\u043e\u0433\u0438 \u044d\u0442\u043e\u0439 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0448\u0430\u0433\u0430\u0445. \u041d\u0443, \u043c\u043e\u0436\u0435\u0442, \u043a\u043e\u043c\u0443-\u0442\u043e \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<h2>\u0428\u0430\u0433 0. \u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c<\/h2>\n<p>\u041d\u0430\u0447\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441 \u043e\u0431\u0449\u0435\u0439 \u0441\u0443\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u042d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432\u0441\u043b\u0435\u043f\u0443\u044e \u0438\u043b\u0438 \u0432 \u043f\u043e\u043b\u0443-\u0441\u043b\u0435\u043f\u0443\u044e. \u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u0435 &#171;\u043a\u0443\u0441\u043e\u0447\u043a\u0438&#187; \u044d\u0442\u043e\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u043b\u044f, \u0438 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043b\u0438\u0448\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043a\u0443\u0441\u043e\u0447\u043a\u0438 \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0437\u0437\u043b.<\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0441 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u00ab\u043e\u043f\u043e\u0440\u043d\u044b\u0445\u00bb \u0442\u043e\u0447\u0435\u043a \u0434\u043b\u044f\u00a0\u0430\u043d\u0430\u043b\u0438\u0437\u0430.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u00a0\u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u043b\u044f &#8212; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u0447\u0435\u043a \u0438 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u043b\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0438\u0445. \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; \u044d\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u043e\u0440\u043d\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0443, \u0442\u043e\u0442 \u0436\u0435 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 (\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 <em>\u0441\u0435\u0433\u043c\u0435\u043d\u0442<\/em> \u0432 \u043c\u043e\u0435\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438).<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u00ab\u043e\u043f\u043e\u0440\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430\u00bb\u00a0\u2014 \u044d\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430\/\u0441\u0442\u043e\u043b\u0431\u0435\u0446. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043b\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fec\/c18\/338\/fecc18338d1eccd0e3e03a6a1e81546e.png\" alt=\"\u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c &quot;\u0447\u0438\u0441\u0442\u043e\u0435&quot; \u0441\u0443\u0434\u043e\u043a\u0443, \u0442.\u043a. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c &gt; 1, \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\" title=\"\u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c &quot;\u0447\u0438\u0441\u0442\u043e\u0435&quot; \u0441\u0443\u0434\u043e\u043a\u0443, \u0442.\u043a. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c &gt; 1, \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\" width=\"908\" height=\"757\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fec\/c18\/338\/fecc18338d1eccd0e3e03a6a1e81546e.png\"\/><\/p>\n<div><figcaption>\u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c &#171;\u0447\u0438\u0441\u0442\u043e\u0435&#187; \u0441\u0443\u0434\u043e\u043a\u0443, \u0442.\u043a. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c &gt; 1, \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/figcaption><\/div>\n<\/figure>\n<p>\u043e\u043f\u043e\u0440\u043d\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 0.0, 1.3, 2.1, 3.2 (\u0441\u0447\u0435\u0442 \u0441 \u043d\u0443\u043b\u044f).<\/p>\n<p>\u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u043c\u0441\u044f \u043a\u00a0\u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a, \u0430\u00a0\u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439\u00a0\u2014 \u0438 \u044d\u0442\u043e \u043f\u0440\u0438\u00a0\u043f\u043e\u043b\u043d\u043e\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044f.<\/p>\n<p>\u041e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u0431\u043e\u0440 \u044d\u0442\u0438\u0445 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0432\u00a0\u043a\u043e\u0434\u0435\u00a0\u2014 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435; \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0431\u043e\u0440 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a\u00a0\u2014 \u044d\u0442\u043e \u043d\u0435\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433, \u0445\u043e\u0442\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043d \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c.<\/p>\n<h2>\u0428\u0430\u0433 1. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u043f\u0443 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u0432.<\/h2>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u0444\u043e\u0440\u043c\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<p><strong>Position<\/strong> &#8212; \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u043f\u043e\u043b\u0435. \u041d\u0438\u0447\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, row \u0434\u0430 column &#8212; \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441 \u043d\u0443\u043b\u044f.<\/p>\n<p><strong>PositionPotential <\/strong>&#8212; \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f, \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0412\u0430\u0436\u043d\u0430\u044f \u043c\u0435\u0442\u0430-\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f <em>possibleNumbers<\/em> &#8212; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0430\/\u0441\u0442\u043e\u043b\u0431\u0435\u0446\/\u043a\u0432\u0430\u0434\u0440\u0430\u0442 (\u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u0434\u043b\u044f 0.0 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 2,3,4 &#8212; 1 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c, \u0442.\u043a. \u043e\u043d\u0430 \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0438\u0437\u0443 \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435 0); <em>squareIndex<\/em> &#8212; \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043f\u043e\u043b\u044f (\u0434\u043b\u044f 2.1, \u0441\u043a\u0430\u0436\u0435\u043c, \u044d\u0442\u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0443\u0434\u0435\u0442 2); <em>segmentInfo <\/em> &#8212; \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u0430\u043c\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c &#8212; \u044d\u0442\u043e <em>segmentPositions<\/em> (\u0434\u043b\u044f 2.1, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 0.1, 1.1, 2.0, 2.2, 2.3, 3.1, \u0442.\u0435. \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u044d\u0442\u043e\u0439 \u043f\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443).<\/p>\n<p><strong>Cell <\/strong>&#8212; \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0438 \u0441 \u0447\u0438\u0441\u043b\u043e\u043c. position, number &#8212; \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u0415\u0441\u043b\u0438 number \u043f\u0443\u0441\u0442\u043e\u0435 &#8212; \u043f\u043e\u043b\u0435 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e.<\/p>\n<p><strong>Sudoku \u0438 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f SudokuImpl <\/strong>&#8212; \u043a\u043b\u0430\u0441\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u043d\u0435\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 n &#8212; \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 field &#8212; \u043d\u0430\u0448\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435.<\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>Position<\/strong><\/p>\n<pre><code class=\"java\">public record Position(         int row,         int column ) {      \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<p><strong>SegmentInfo<\/strong><\/p>\n<pre><code class=\"java\">import java.util.HashSet; import java.util.Objects; import java.util.Set;  public record SegmentInfo(Position startingPoint,                           Set&lt;Integer&gt; possibleNumbers,                           Set&lt;Position&gt; segmentPositions) {     \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<p><strong>PositionPotential<\/strong><\/p>\n<pre><code class=\"java\">import java.util.HashSet; import java.util.Set;  public class PositionPotential {      private final Set&lt;Integer&gt; possibleNumbers;      private SegmentInfo segmentInfo;      private int squareIndex;      public PositionPotential(int possibleNumber) {         Set&lt;Integer&gt; setWithSingleNumber = new HashSet&lt;&gt;();         setWithSingleNumber.add(possibleNumber);          this.possibleNumbers = setWithSingleNumber;     }      public PositionPotential(Set&lt;Integer&gt; possibleNumbers, int squareIndex) {         this.possibleNumbers = possibleNumbers;         this.squareIndex = squareIndex;     }      public PositionPotential(Set&lt;Integer&gt; possibleNumbers, SegmentInfo segmentInfo, int squareIndex) {         this.possibleNumbers = possibleNumbers;         this.segmentInfo = segmentInfo;         this.squareIndex = squareIndex;     }      \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0447\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<p><strong>Cell<\/strong><\/p>\n<pre><code class=\"java\">public record Cell(         Position position,         Integer number ) {     public boolean isEmpty() {         return number == null;     }     \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0447\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">public interface Sudoku {      int[][] getVariant();      boolean checkVariant(int[][] variant); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0421 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b field \u0432\u0441\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 &#8212; \u043f\u0443\u0441\u0442\u044b\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 &#8212; \u0438 \u043f\u043e \u043d\u0438\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u043f\u0443 \u0438\u0437 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b, \u043e\u043d \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u044b\u0439 &#8212; \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u043a\u043e\u0434\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"java\">Set&lt;Cell&gt; cells = getCells(this.field); Map&lt;Position, PositionPotential&gt; positionPotentialMap = createNewPotentialMapForCells(cells);<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0435\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 &#171;\u043e\u043f\u043e\u0440\u043d\u044b\u0435&#187; \u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a.<\/p>\n<details class=\"spoiler\">\n<summary>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u0440\u0438\u0432\u043e\u0432\u0430\u0442\u043e, \u043d\u043e \u0432\u0440\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private Set&lt;Position&gt; getPositionsForAnalyze(Map&lt;Position, PositionPotential&gt; positionPotentialMap) {         Set&lt;Position&gt; result = new HashSet&lt;&gt;();          \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438         Set&lt;Integer&gt; rowsToFeel = positionPotentialMap.keySet().stream().map(Position::row).collect(Collectors.toSet());          \/\/ \u0442.\u043a. \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u043c\u0430\u043f\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 - \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0435 \u043a\u043e\u043f\u0438\u044e         Map&lt;Position, PositionPotential&gt; positionPositionPotentialCopy = copyOfPotentialMap(positionPotentialMap);          for (int row : rowsToFeel) {             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439; \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0445 \u043d\u0435\u0442 - \u0434\u043e\u0443\u0434\u0430\u043b\u044f\u043b\u0438\u0441\u044c. \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043c\u0430\u043f\u0443, \u043e\u0442\u043a\u0438\u043d\u0443\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u043e\u0440\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438.             Position firstPositionWithRow = positionPositionPotentialCopy.keySet().stream().filter(p -&gt; p.row() == row).findFirst().orElse(null);             if (firstPositionWithRow == null) {                 positionPositionPotentialCopy = copyOfPotentialMap(positionPotentialMap);                 for (Position position : result) {                     positionPositionPotentialCopy.remove(position);                 }                 firstPositionWithRow = positionPositionPotentialCopy.keySet().stream().filter(p -&gt; p.row() == row).findFirst().orElseThrow();             }              \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435             result.add(firstPositionWithRow);              Set&lt;Position&gt; positionsToDelete = new HashSet&lt;&gt;();             positionsToDelete.add(firstPositionWithRow);              int squareOfPosition = positionPositionPotentialCopy.get(firstPositionWithRow).getSquareIndex();              \/\/ \u0432\u0441\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0443, \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f - \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u043b\u0438\u0431\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438             Position finalFirstPositionWithRow = firstPositionWithRow;             Set&lt;Position&gt; connectedPositions = positionPositionPotentialCopy.entrySet().stream().filter(es -&gt; {                 Position position = es.getKey();                 PositionPotential positionPotential = es.getValue();                  return position.row() == finalFirstPositionWithRow.row() || position.column() == finalFirstPositionWithRow.column() || positionPotential.getSquareIndex() == squareOfPosition;             }).map(Map.Entry::getKey).collect(Collectors.toSet());              \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c             positionsToDelete.addAll(connectedPositions);              for (Position positionToDelete : positionsToDelete) {                 positionPositionPotentialCopy.remove(positionToDelete);             }         }          return result;     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<pre><code class=\"java\">Set&lt;Position&gt; positionsToAnalyze = getPositionsForAnalyze(positionPotentialMap);<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, &#171;\u043e\u043f\u043e\u0440\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438&#187; \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0435.<\/p>\n<h2>\u0428\u0430\u0433 2. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f, \u043f\u043e\u0434\u0431\u043e\u0440 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432<\/h2>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p><strong>PossibleNumbersValidationResult &#8212;<\/strong> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442; \u0432\u0430\u043b\u0438\u0434\u043d\u043e\/\u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e &#8212; \u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0438\u0431\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u043d\u0443 \u044f\u0447\u0435\u0439\u043a\u0443 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c); \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 &#8212; \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0446\u0438\u0444\u0435\u0440\u0438.<\/p>\n<p><strong>PossibleNumberValidationResult &#8212;<\/strong> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442; \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u0446\u0438\u0444\u0435\u0440\u0438; \u0432\u0430\u043b\u0438\u0434\u043d\u043e\/\u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e &#8212; \u0432\u0435\u0442\u043a\u0438 \u0441 \u044d\u0442\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c). \u0418 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0438\u0437 <em>SegmentValidBatch,<\/em> \u043e \u043d\u0435\u043c \u043d\u0438\u0436\u0435.<\/p>\n<p><strong>CellsVariant &#8212; <\/strong>\u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u044f (\u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430). \u041f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 Cell, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0442\u0438\u043f\u043e\u043c ROW, COLUMN \u0438\u043b\u0438 SQUARE.<\/p>\n<p><strong>SegmentValidBatch &#8212;<\/strong> \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u0430\u043a \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043e\u043f\u043e\u0440\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443). \u0418\u043c\u0435\u0435\u0442 \u0442\u0440\u0438 CellsVariant &#8212; \u0441\u0442\u0440\u043e\u043a\u0430, \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043a\u0432\u0430\u0434\u0440\u0430\u0442.<\/p>\n<p>\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0441\u043d\u0430, \u0432\u043e\u0442<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>PossibleNumbersValidationResult <\/strong><\/p>\n<pre><code class=\"java\">public record PossibleNumbersValidationResult(         Position forPosition,         boolean isValid,         Map&lt;Integer, PossibleNumberValidationResult&gt; validationResultByNumber ) { \/\/... \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438 }<\/code><\/pre>\n<p><strong>PossibleNumberValidationResult <\/strong><\/p>\n<pre><code class=\"java\">public record PossibleNumberValidationResult(         Position forPosition,         int number,         boolean isValid,         List&lt;SegmentValidBatch&gt; segmentValidBatches ) { \/\/... \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438 }<\/code><\/pre>\n<p><strong>CellsVariant <\/strong><\/p>\n<pre><code class=\"java\">public class CellsVariant {      private final Set&lt;Cell&gt; cells;      private UUID batchUUID;      private final UUID uuid;      private final SubSegmentType type;    \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u043d\u0435\u043a\u0443\u044e \u043e\u043f\u043e\u0440\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0438 \u0438\u0434\u0435\u043c \u0435\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043b\u0438\u0441\u0442. \u0422\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c &#8212; \u044d\u0442\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0435\u0441\u0442\u044c \u0442\u043e\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u0447\u0442\u043e \u043f\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u043a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c &#8212; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043f\u043e\u043a\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439).<\/p>\n<pre><code class=\"java\">List&lt;PossibleNumbersValidationResult&gt; possibleNumbersValidationResults = new ArrayList&lt;&gt;(); for (Position position : positionsToAnalyze) {       PossibleNumbersValidationResult possibleNumbersValidationResult = possibleNumbersValidation(position, positionPotentialMap);       possibleNumbersValidationResults.add(possibleNumbersValidationResult); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 possibleNumbersValidation<\/p>\n<details class=\"spoiler\">\n<summary>possibleNumbersValidation<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private PossibleNumbersValidationResult possibleNumbersValidation(Position position,                                                                       Map&lt;Position, PositionPotential&gt; positionPotentialMap) {         PositionPotential potential = positionPotentialMap.get(position);         Set&lt;Integer&gt; possibleNumbers = potential.getPossibleNumbers();          \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438         Map&lt;Position, PositionPotential&gt; positionSegment = getSegment(position, positionPotentialMap);          \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 - \u0442.\u0435. \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430         Map&lt;Position, PositionPotential&gt; positionsByRow = positionSegment.entrySet().stream().filter(p -&gt; Objects.equals(p.getKey().row(), position.row())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 - \u0442.\u0435. \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430         Map&lt;Position, PositionPotential&gt; positionsByColumn = positionSegment.entrySet().stream().filter(p -&gt; Objects.equals(p.getKey().column(), position.column())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0443 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 - \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u0442\u043e\u043c \u043c\u044b \u0443\u0431\u0435\u0440\u0435\u043c \u0442\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c         Map&lt;Position, PositionPotential&gt; positionsBySquare = positionSegment.entrySet().stream().filter(p -&gt; p.getValue().getSquareIndex() == potential.getSquareIndex()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));          boolean isValid = false;         Map&lt;Integer, PossibleNumberValidationResult&gt; possibleNumberValidationResultMap = new HashMap&lt;&gt;();          \/\/ \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c\u0441\u044f         for (int possibleNumber : possibleNumbers) {             PossibleNumberValidationResult possibleNumberValidationResult = possibleNumberValidation(position, possibleNumber, positionsByRow, positionsByColumn, positionsBySquare);             possibleNumberValidationResultMap.put(possibleNumber, possibleNumberValidationResult);             \/\/ \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f \u0446\u0438\u0444\u0440\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u0430 - \u0432 \u0446\u0435\u043b\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0430\u043b\u0438\u0434\u0435\u043d             if (possibleNumberValidationResult.isValid()) {                 isValid = true;             }         }          return new PossibleNumbersValidationResult(position, isValid, possibleNumberValidationResultMap);     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u0435\u0442\u043e\u0434 possibleNumberValidation \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0432\u0430\u0442\u043e \u0438 \u043e \u043d\u0435\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435. \u041f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 validateSubSegmentAfterDeletion &#8212; \u043e\u043d \u043f\u0440\u0438\u0437\u0432\u0430\u043d \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u043f\u0443-\u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 (\u0441\u0442\u0440\u043e\u043a\u0430, \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043a\u0432\u0430\u0434\u0440\u0430\u0442), \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 &#8212; \u0442\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0441\u0430\u043c\u0430\u044f \u043c\u044f\u043a\u043e\u0442\u043a\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0435\u0433\u043e \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0434\u0442\u0438 \u0432\u0433\u043b\u0443\u0431\u044c.<\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0432 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ul>\n<li>\n<p>\u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0432 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435. \u0415\u0441\u043b\u0438 \u0435\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c &#8212; \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442. \u041d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0446\u0438\u0444\u0440\u044b. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0435 \u0435\u0441\u0442\u044c &#8212; \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u0445, \u043a\u0430\u043a \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0412\u044b\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439. \u0414\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0446\u0438\u043a\u043b\u0438\u0447\u043d\u043e, \u043f\u043e\u043a\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f &#171;\u0435\u0441\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0432 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435&#187; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u0442.\u043a. \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c &#171;\u0446\u0435\u043f\u043d\u0430\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u044f&#187;. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e \u0438\u0442\u043e\u0433\u0443 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0443\u0441\u0442\u044b\u043c &#8212; \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043d\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u0435\u043d.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0443\u0436\u0435 \u0441\u0442\u0440\u043e\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439, \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e-\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432.<\/p>\n<p>\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043e\u0434.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private SubSegmentFillingResult validateSubSegmentAfterDeletion(Map&lt;Position, PositionPotential&gt; subSegment,                                                                     Position forPosition,                                                                     int number,                                                                     SubSegmentType subSegmentType) {         \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c.         SubSegmentFillingResult result = new SubSegmentFillingResult(subSegmentType);         \/\/ \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0443\u0441\u0442 \u0438 \u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f - \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0435\u043c true         if (subSegment.isEmpty()) {             result.setValid(true);             return result;         }          \/\/ \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u044f\u0447\u0435\u0439\u043a\u0438 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c         Set&lt;Cell&gt; mandatoryCells = new HashSet&lt;&gt;();          \/\/ \u043c\u0430\u043f\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0442\u0430 \u0438\u043b\u0438 \u0438\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.         Map&lt;Set&lt;Integer&gt;, Integer&gt; combinationCount = new HashMap&lt;&gt;();          \/\/ \u043c\u0430\u043f\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0434\u0435\u0440\u0436\u0438\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u043e\u043e\u0442\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f mandatoryCells.         Map&lt;Position, Integer&gt; singleElementsMap = new HashMap&lt;&gt;();          Map&lt;Position, PositionPotential&gt; copyOfSegment = copyOfPotentialMap(subSegment);          for (Map.Entry&lt;Position, PositionPotential&gt; segmentEntry : copyOfSegment.entrySet()) {             Position position = segmentEntry.getKey();             PositionPotential positionPotential = segmentEntry.getValue();              \/\/ \u0432\u0435\u0434\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u043e\u0441\u0442\u0438             Set&lt;Integer&gt; possibleNumbers = positionPotential.getPossibleNumbers();             combinationCount.putIfAbsent(possibleNumbers, 0);             combinationCount.put(possibleNumbers, combinationCount.get(possibleNumbers) + 1);              \/\/ \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e - \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u0430\u043f\u0443 singleElementsMap             if (possibleNumbers.size() == 1) {                 singleElementsMap.put(position, possibleNumbers.stream().findFirst().orElseThrow());             }         }          \/\/ \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0445\u043e\u0442\u044c \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f, \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c - \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043c\u044b \u0443\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u0432\u0435\u0440\u0434\u0438\u043a\u0442 - \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e.         for (Map.Entry&lt;Set&lt;Integer&gt;, Integer&gt; combinationCountEntry : combinationCount.entrySet()) {             Set&lt;Integer&gt; combination = combinationCountEntry.getKey();             Integer count = combinationCountEntry.getValue();              if (count &gt; combination.size()) {                 result.setValid(false);                 return result;             }         }          do {             \/\/ \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u043c\u0430\u043f\u043e\u0439 singleElementsMap, \u0442.\u0435. \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.             \/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043f\u043e \u043d\u0438\u043c mandatoryCells, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \"\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435\" \u044d\u0442\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 + \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e, \u043a\u0430\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435             \/\/ \u0442.\u043a. \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \"\u0446\u0435\u043f\u043d\u0443\u044e \u0440\u0435\u0430\u043a\u0446\u0438\u044e\" - \u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435.             Set&lt;Integer&gt; singleElementsSet = new HashSet&lt;&gt;(singleElementsMap.values());              for (Map.Entry&lt;Position, Integer&gt; singeElementEntry : singleElementsMap.entrySet()) {                 Position position = singeElementEntry.getKey();                 Integer mandatoryNumber = singeElementEntry.getValue();                  mandatoryCells.add(new Cell(position, mandatoryNumber));                  copyOfSegment.remove(position);             }              if (copyOfSegment.isEmpty()) {                 break;             }              for (PositionPotential potential : copyOfSegment.values()) {                 potential.removePossibleNumbers(singleElementsSet);                 if (potential.getPossibleNumbers().isEmpty()) {                     \/\/ \u0435\u0441\u043b\u0438 \u043f\u043e \u0438\u0442\u043e\u0433\u0443 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044e - \u0442\u043e \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043d\u0435\u0437\u0434\u043e\u0440\u043e\u0432\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f. \u0432\u0435\u0440\u0434\u0438\u043a\u0442 - \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e.                     result.setValid(false);                     return result;                 }             }              singleElementsMap = copyOfSegment.entrySet()                     .stream()                     .filter(e -&gt; e.getValue().getPossibleNumbers().size() == 1)                     .collect(Collectors.toMap(Map.Entry::getKey, v -&gt; v.getValue().getPossibleNumbers().stream().findFirst().orElseThrow()));         } while (!singleElementsMap.isEmpty());           \/\/ \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434, \u0441\u0442\u0440\u043e\u044f\u0449\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0438 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f mandatoryCells         NumberSequenceVariant&lt;Position&gt; numberSequenceVariants = getMainVariantForSubSegment(copyOfSegment, mandatoryCells, forPosition, number);          result.setNumberSequenceVariant(numberSequenceVariants);          if (numberSequenceVariants.isEnd()) {             result.setValid(false);             return result;         }          result.setValid(true);          return result;     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c &#8212; \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c getMainVariantForSubSegment, getVariantOnRootNumberForSubSegment \u0438 \u0444\u0440\u0430\u043d\u043a\u0435\u043d\u0448\u0442\u0435\u0439\u043d\u0443 NumberSequenceVariant.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 getMainVariantForSubSegment \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0431\u0430\u043d\u043d\u0438\u043a \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043d\u043e\u0432\u0430 \u043e\u0431\u043e\u0433\u0430\u0442\u0438\u0442 \u043d\u0430\u043c \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 mandatoryCells (\u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u044f \u043d\u0435 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0437\u0430\u0447\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u043b \u0442\u0430\u043a\u0443\u044e \u0441\u0432\u0438\u0441\u0442\u043e\u043f\u043b\u044f\u0441\u043a\u0443 \u0441 \u043f\u0435\u0440\u0435\u0433\u043e\u043d\u043a\u043e\u0439 \u0432 Cell \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 Map \u0437\u0434\u0435\u0441\u044c, \u043d\u043e \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0439, \u0447\u0442\u043e \u043b\u0438&#8230;); \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0437 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043f\u043e \u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0446\u0438\u0444\u0435\u0440\u044f\u043c &#171;\u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439&#187; NumberSequenceVariant, \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0448\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private NumberSequenceVariant&lt;Position&gt; getMainVariantForSubSegment(Map&lt;Position, PositionPotential&gt; subSegment, Set&lt;Cell&gt; mandatoryCells, Position forPosition, int number) {         \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \"\u043a\u043e\u0440\u043d\u044f\"         NumberSequenceVariant&lt;Position&gt; numberSequenceVariant = new NumberSequenceVariant&lt;&gt;(number, forPosition);         List&lt;NumberSequenceVariant&lt;Position&gt;&gt; resultsByPossibleNumbersInFirstPositionInSubSegment = new ArrayList&lt;&gt;();          Map&lt;Position, PositionPotential&gt; subSegmentCopy = copyOfPotentialMap(subSegment);          \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c mandatoryCell \u043d\u0430 \u0441\u0432\u043e\u0438 \u043c\u0435\u0441\u0442\u0430         for (Cell mandatoryCell : mandatoryCells) {             subSegmentCopy.put(mandatoryCell.position(), new PositionPotential(mandatoryCell.number()));         }          Position firstPosition = subSegmentCopy.keySet().stream().findFirst().orElseThrow();         Set&lt;Integer&gt; possibleNumbersForFirstPosition = subSegmentCopy.values().stream().findFirst().map(PositionPotential::getPossibleNumbers).orElseThrow();          \/\/ \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 - \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0438 \u0443\u0445\u043e\u0434\u0438\u043c; \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0438 \u043a \u0447\u0435\u043c\u0443.         if (subSegmentCopy.size() == 1) {             for (int possibleNumber : possibleNumbersForFirstPosition) {                 resultsByPossibleNumbersInFirstPositionInSubSegment.add(new NumberSequenceVariant&lt;&gt;(possibleNumber, firstPosition));             }             numberSequenceVariant.justAddNewVariantsToBranches(resultsByPossibleNumbersInFirstPositionInSubSegment);             return numberSequenceVariant;         }          \/\/ \u043e\u043d\u043e \u043d\u0430\u043c \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0437\u0431\u043e\u0440\u0435...         subSegmentCopy.remove(firstPosition);          \/\/ \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0446\u0438\u0444\u0440\u0430\u043c \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b         for (int possibleNumber : possibleNumbersForFirstPosition) {             NumberSequenceVariant&lt;Position&gt; variant = getVariantOnRootNumberForSubSegment(possibleNumber, firstPosition, subSegmentCopy);             \/\/ \u0435\u0441\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u0435\u0440\u043d\u0443\u043b null - \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0443\u0442\u043d\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435 \u0432\u044b\u0448\u043b\u043e. \u0443\u0432\u044b. null-\u044b \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b.             if (variant != null) {                 resultsByPossibleNumbersInFirstPositionInSubSegment.add(variant);             }         }          \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e \u0446\u0438\u0444\u0440\u0430\u043c \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e         numberSequenceVariant.justAddNewVariantsToBranches(resultsByPossibleNumbersInFirstPositionInSubSegment);         return numberSequenceVariant;     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u043a getVariantOnRootNumberForSubSegment &#8212; \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u0444\u0440\u0430\u043d\u043a\u0435\u043d\u0448\u0442\u0435\u0439\u043d\u0430\u0445.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445\u00a0\u2014 NumberSequenceVariant. \u0427\u0442\u043e\u2011\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0434\u0435\u0440\u0435\u0432\u0430, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0435\u043c\u043d\u043e\u0435, \u043a\u0430\u043a\u00a0\u0438\u0437\u00a0\u0444\u0438\u043b\u044c\u043c\u0430 \u00ab\u0421\u043e\u043d\u043d\u0430\u044f \u043b\u043e\u0449\u0438\u043d\u0430\u00bb. \u0421\u0443\u0442\u044c \u0435\u0433\u043e \u0432\u00a0\u0442\u043e\u043c, \u0447\u0442\u043e\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u00ab\u0443\u0437\u0435\u043b\u00bb \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u00a0\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439\u00a0\u2014 \u044d\u0442\u043e \u0440\u0430\u0437; \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u00ab\u0432\u043d\u0438\u0437\u00bb \u0438\u0437\u00a0\u0447\u0438\u0441\u0435\u043b \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432\u0435\u0442\u043a\u0443\u00a0\u2014 \u044d\u0442\u043e \u0434\u0432\u0430; \u0432\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u00a0\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f\u00a0\u2014 \u044d\u0442\u043e \u0442\u0440\u0438; \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f\u00a0\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0442\u043e\u043a \u043d\u0438\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438\u00a0\u2014 \u044d\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u044d\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435; \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u00a0\u0432\u0435\u0442\u043e\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043d\u044f\u0442\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432\u00a0\u2014 \u044d\u0442\u043e \u043f\u044f\u0442\u044c. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u043d\u043e\u00a0\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0430\u0445\u0438\u0432\u0430\u0435\u0442, \u043d\u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041f\u043e\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c\u00a0\u0431\u044b, \u043d\u043e\u00a0\u0442\u0440\u043e\u0433\u0430\u0442\u044c \u0443\u0436\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u044f\u0437\u043d\u043e \ud83d\ude42<\/p>\n<details class=\"spoiler\">\n<summary>\u0410 \u0432\u043e\u0442 \u0438 \u043e\u043d\u043e, \u0440\u043e\u0434\u0438\u043c\u043e\u0435, \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0436\u0430\u0441\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">public class NumberSequenceVariant&lt;KEY&gt; {     private final int number;     private final KEY key;     private final List&lt;NumberSequenceVariant&lt;KEY&gt;&gt; branches = new ArrayList&lt;&gt;();      public NumberSequenceVariant(int number, KEY key) {         this.number = number;         this.key = key;     }      public boolean isEnd() {         return branches.isEmpty();     }      public void justAddNewVariantsToBranches(List&lt;NumberSequenceVariant&lt;KEY&gt;&gt; newVariants) {         branches.addAll(newVariants);     }      public void justAddWithIgnoringSame(int number, KEY key) {         if (number == this.number) {             return;         }         branches.add(new NumberSequenceVariant&lt;&gt;(number, key));     }      public boolean addVariantToEndOfPathWithIgnoringSame(int number, KEY keyOfVariant, Set&lt;KEY&gt; passedPath) {         if (number == this.number) {             return false;         }          Set&lt;KEY&gt; pathWithoutCurrentPosition = new HashSet&lt;&gt;(passedPath);          boolean wasDeletedInPath = pathWithoutCurrentPosition.remove(key);          if (!wasDeletedInPath) {             return false;         }          if (pathWithoutCurrentPosition.isEmpty()) {             branches.add(new NumberSequenceVariant&lt;&gt;(number, keyOfVariant));             return true;         }          boolean wasAdding = false;          for (NumberSequenceVariant&lt;KEY&gt; child : branches) {             if (child.addVariantToEndOfPathWithIgnoringSame(number, keyOfVariant, pathWithoutCurrentPosition)) {                 wasAdding = true;             }         }          return wasAdding;     }      \/**      * \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0432\u0435\u0442\u043e\u043a, \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442.      *\/     public void removeAllBranchesWithSizeLessThan(int size) {         if (size == 1 || isEnd()) {             return;         }          Set&lt;NumberSequenceVariant&lt;KEY&gt;&gt; toDelete = new HashSet&lt;&gt;();         for (NumberSequenceVariant&lt;KEY&gt; branch : branches) {             int counter = 1;             boolean result = branch.removeRecursion(size, counter);             if (!result) {                 toDelete.add(branch);             }         }          branches.removeAll(toDelete);     }      public Set&lt;Set&lt;Pair&lt;KEY, Integer&gt;&gt;&gt; getKeyValuePairs() {         Set&lt;Set&lt;Pair&lt;KEY, Integer&gt;&gt;&gt; result = new HashSet&lt;&gt;();         Pair&lt;KEY, Integer&gt; currentCell = Pair.of(key, number);          for (NumberSequenceVariant&lt;KEY&gt; branch : branches) {             if (branch.isEnd()) {                 Set&lt;Pair&lt;KEY, Integer&gt;&gt; singleSet = new HashSet&lt;&gt;();                 singleSet.add(Pair.of(branch.key, branch.number));                 singleSet.add(currentCell);                 result.add(singleSet);                 continue;             }             Set&lt;Set&lt;Pair&lt;KEY, Integer&gt;&gt;&gt; resultsFromBranch = branch.getKeyValuePairs();             for (Set&lt;Pair&lt;KEY, Integer&gt;&gt; resultFromBranch : resultsFromBranch) {                 Set&lt;Pair&lt;KEY, Integer&gt;&gt; appendedWithCurrentCell = new HashSet&lt;&gt;(resultFromBranch);                 appendedWithCurrentCell.add(currentCell);                 result.add(appendedWithCurrentCell);             }         }          if (result.isEmpty()) {             Set&lt;Pair&lt;KEY, Integer&gt;&gt; singleSet = new HashSet&lt;&gt;();             singleSet.add(Pair.of(key, number));             result.add(singleSet);         }          return result;     }      private boolean removeRecursion(int size, int counter) {         counter++;          if (isEnd()) {             return counter &gt;= size;         }          boolean result = false;         Set&lt;NumberSequenceVariant&lt;KEY&gt;&gt; toDelete = new HashSet&lt;&gt;();         for (NumberSequenceVariant&lt;KEY&gt; branch : branches) {             result = branch.removeRecursion(size, counter);             if (!result) {                 toDelete.add(branch);             }         }          branches.removeAll(toDelete);          return !isEnd();     }      @Override     public boolean equals(Object o) {         if (o == null || getClass() != o.getClass()) return false;         NumberSequenceVariant&lt;KEY&gt; that = (NumberSequenceVariant) o;         return number == that.number &amp;&amp; Objects.equals(key, that.key);     }      @Override     public int hashCode() {         return Objects.hash(number, key);     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0442\u043e\u0440\u043e\u0435 &#8212; \u044d\u0442\u043e VariantSelectionElementChain.<\/p>\n<p>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d \u043d\u0443\u0436\u0435\u043d?<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0442\u0430\u043a\u043e\u043c\u0443:<\/p>\n<p>\u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0432\u0441\u0435\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 &#171;\u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0435&#187; \u0447\u0438\u0441\u043b\u043e (\u0442.\u0435. \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0435). \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0432\u044b\u0448\u043b\u043e \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<p>\u043f\u043e\u0437\u0438\u0446\u0438\u044f x1.y1: {2, 3}<\/p>\n<p>\u043f\u043e\u0437\u0438\u0446\u0438\u044f x2.y2: {1}<\/p>\n<p>\u043f\u043e\u0437\u0438\u0446\u0438\u044f x3.y3: {4}<\/p>\n<p>\u043f\u043e\u0437\u0438\u0446\u0438\u044f x4.y4: {3, 4}<\/p>\n<p>\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, x2.y2 \u0438 x3.y3 \u0443 \u043d\u0430\u0441 \u0432\u044b\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u0445.<\/p>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u043e\u0436\u0435 \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c (\u043f\u0440\u0430\u0432\u0434\u0430, \u044f \u0443\u0436\u0435 \u0437\u0430\u0431\u044b\u043b, \u0432 \u0447\u0435\u043c \u0431\u044b\u043b\u0430 \u043c\u043e\u044f \u0437\u0430\u0434\u0443\u043c\u043a\u0430, \u0432\u0438\u043d\u043e\u0432\u0430\u0442 :)).<\/p>\n<p>\u0411\u0435\u0440\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0446\u0438\u0444\u0440\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 NumberSequenceVariant, \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0435\u0446.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c.<\/p>\n<p>\u0418\u0434\u0435\u043c \u043f\u043e\u043f\u0430\u0440\u043d\u043e, \u0431\u0435\u0440\u0435\u043c \u043b\u0435\u0432\u043e\u0435 \u0438 \u043f\u0440\u0430\u0432\u043e\u0435; \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 &#8212; \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0434\u0435\u0440\u0435\u0432\u043e, \u0438 \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0439 &#8212; \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u044d\u0442\u043e \u0434\u0435\u043b\u043e, \u0442.\u043a. \u0442\u0443\u0442 \u0443\u0436\u0435 \u044f\u0432\u043d\u044b\u0439 \u0442\u0443\u043f\u0438\u043a (\u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u043a\u0440\u0430\u043b\u0438\u0441\u044c \u0434\u0432\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e-\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430); \u0435\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435\u0442 &#8212; \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0446\u0438\u0444\u0440\u0435 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0433\u043e. \u0415\u0441\u043b\u0438 \u043b\u0435\u0432\u043e\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0446\u0438\u0444\u0440\u0443 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0438 \u043b\u0435\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 1 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 &#8212; \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442; \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 &#8212; \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432 \u0434\u0435\u0440\u0435\u0432\u043e; \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u0430 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f &#8212; \u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441; \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 &#8212; \u0442\u043e \u044d\u0442\u043e \u0442\u0443\u043f\u0438\u043a.<\/p>\n<p>\u041d\u0443 \u0438 \u0434\u0430, \u043f\u043e \u0442\u043e\u043c\u0443, \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u0432\u0435\u0442\u0432\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0446\u0438\u0444\u0440\u044b &#8212; \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f passedPath, \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0439 (\u044f \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u043e\u044f\u0441\u043d\u044e: passedPath &#8212; &#171;\u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c&#187; xD). \u0422\u0430 \u0441\u0430\u043c\u0430\u044f, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 addVariantToEndOfPathWithIgnoringSame. \u041c\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u0438\u0431\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043b\u0438\u0431\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0435-\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445. \u0414\u0430, \u0442\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0442\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438 \u0432\u0435\u0442\u043a\u0430\u043c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043b\u0438\u043b\u043e\u0441\u044c&#8230; \u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438-\u043d\u0435\u0443\u0434\u0430\u0447\u043d\u0438\u043a\u0438 \u043d\u0430\u043c \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b, \u043c\u044b \u0438\u0445 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u043e\u0442\u043e\u043c &#171;\u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c&#187;.<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, VariantSelectionElementChain \u043d\u0443\u0436\u0435\u043d \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438.<\/p>\n<p>\u041a\u043e\u0434 VariantSelectionElementChain.<\/p>\n<details class=\"spoiler\">\n<summary>\u0422\u0443\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">public class VariantSelectionElementChain implements Comparable&lt;VariantSelectionElementChain&gt; {      private final Position position;      private final List&lt;Integer&gt; sortedPossibleNumbers;      public VariantSelectionElementChain(Position position, PositionPotential positionPotential, int excludeNumber) {         this.position = position;         PositionPotential potentialCopy = positionPotential.safeCopy();          this.sortedPossibleNumbers = potentialCopy.getPossibleNumbers().stream().filter(n -&gt; n != excludeNumber).sorted().toList();     }      @Override     public int compareTo(VariantSelectionElementChain o) {         int first = sortedPossibleNumbers.size();         int second = o.sortedPossibleNumbers.size();          return Integer.compare(first, second);     }      public Position getPosition() {         return position;     }      public List&lt;Integer&gt; getSortedPossibleNumbers() {         return sortedPossibleNumbers;     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u0442\u0440\u0430\u0445 \u0431\u043e\u0436\u0438\u0439, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0431\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 &#8212; \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432\u0440\u043e\u0434\u0435 \u0438 \u0442\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\"> private NumberSequenceVariant&lt;Position&gt; getVariantOnRootNumberForSubSegment(int number, Position position, Map&lt;Position, PositionPotential&gt; subSegment) {         Set&lt;Position&gt; passedPath = new HashSet&lt;&gt;();         NumberSequenceVariant&lt;Position&gt; result = new NumberSequenceVariant&lt;&gt;(number, position);          passedPath.add(position);          List&lt;VariantSelectionElementChain&gt; variantSelectionChain = subSegment.entrySet()                 .stream()                 .map(es -&gt; new VariantSelectionElementChain(es.getKey(), es.getValue(), number))                 .sorted()                 .toList();          VariantSelectionElementChain firstElement = variantSelectionChain.stream().findFirst().orElseThrow();         for (int possibleNumberInFirstElement : firstElement.getSortedPossibleNumbers()) {             result.justAddWithIgnoringSame(possibleNumberInFirstElement, firstElement.getPosition());         }         if (result.isEnd()) {             return null;         }          if (variantSelectionChain.size() == 1) {             return result;         }          passedPath.add(firstElement.getPosition());          for (int i = 0; i &lt; variantSelectionChain.size() - 1; i++) {             VariantSelectionElementChain leftElement = variantSelectionChain.get(i);             VariantSelectionElementChain rightElement = variantSelectionChain.get(i + 1);              Position rightElementPosition = rightElement.getPosition();              List&lt;Integer&gt; numbersForLeft = leftElement.getSortedPossibleNumbers();             List&lt;Integer&gt; numbersForRight = rightElement.getSortedPossibleNumbers();              boolean wasAdding = false;              if (numbersForRight.size() == 1) {                 wasAdding = result.addVariantToEndOfPathWithIgnoringSame(numbersForRight.stream().findFirst().orElseThrow(), rightElementPosition, passedPath);                 if (!wasAdding) {                     break;                 }                 passedPath.add(rightElementPosition);                 continue;             }              for (int numberInRight : numbersForRight) {                 if ((numbersForLeft.contains(numberInRight) &amp;&amp; numbersForLeft.size() == 1)) {                     continue;                 }                 if (result.addVariantToEndOfPathWithIgnoringSame(numberInRight, rightElementPosition, passedPath)) {                     wasAdding = true;                 }             }              if (!wasAdding) {                 break;             }              passedPath.add(rightElementPosition);         }          result.removeAllBranchesWithSizeLessThan(subSegment.size() + 1);         if (result.isEnd()) {             return null;         }          return result;     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0439 \u044d\u0442\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SubSegmentFillingResult, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u0432\u0430\u043b\u0438\u0434\u0435\u043d\/\u043d\u0435\u0432\u0430\u043b\u0438\u0434\u0435\u043d \u043b\u0438 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442 (\u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432); \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 NumberSequenceVariant \u0438 \u0442\u0438\u043f \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430.<\/p>\n<h3>\u0428\u0430\u0433 3. \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u043f\u043e\u0434\u0431\u043e\u0440 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432<\/h3>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 possibleNumberValidation. \u041a\u0430\u043a \u044f \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u043a\u043e\u0434 \u0443 \u043d\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0432\u0430\u0442\u044b\u0439 \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u0432 \u0438\u0442\u043e\u0433\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u043c \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044f \u0438\u0445 \u0432 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 &#171;\u0431\u0430\u0442\u0447\u0438&#187;.<\/p>\n<details class=\"spoiler\">\n<summary>\u0410 \u0432\u043e\u0442 \u0438 \u043e\u043d<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private PossibleNumberValidationResult possibleNumberValidation(Position forPosition,                                                                     int number,                                                                     Map&lt;Position, PositionPotential&gt; positionsByRow,                                                                     Map&lt;Position, PositionPotential&gt; positionsByColumn,                                                                     Map&lt;Position, PositionPotential&gt; positionsBySquare) {         Map&lt;Position, PositionPotential&gt; positionsByRowCopyWithoutNumber = copyOfPotentialMap(positionsByRow).entrySet().stream().peek(e -&gt; e.getValue().removePossibleNumber(number)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));         Map&lt;Position, PositionPotential&gt; positionsByColumnCopyWithoutNumber = copyOfPotentialMap(positionsByColumn).entrySet().stream().peek(e -&gt; e.getValue().removePossibleNumber(number)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));         Map&lt;Position, PositionPotential&gt; positionsBySquareCopyWithoutNumber = copyOfPotentialMap(positionsBySquare).entrySet().stream().peek(e -&gt; e.getValue().removePossibleNumber(number)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));          Set&lt;Position&gt; positionsIntersectionsWithSquare = new HashSet&lt;&gt;();          for (Position positionInRow : positionsByRowCopyWithoutNumber.keySet()) {             if (positionsBySquareCopyWithoutNumber.remove(positionInRow) != null) {                 positionsIntersectionsWithSquare.add(positionInRow);             }         }          for (Position positionInColumn : positionsByColumnCopyWithoutNumber.keySet()) {             if (positionsBySquareCopyWithoutNumber.remove(positionInColumn) != null) {                 positionsIntersectionsWithSquare.add(positionInColumn);             }         }          SubSegmentFillingResult columnSubSegmentFillingResult = new SubSegmentFillingResult(SubSegmentType.COLUMN);         columnSubSegmentFillingResult.setValid(true);         if (!positionsByRowCopyWithoutNumber.isEmpty()) {             columnSubSegmentFillingResult = validateSubSegmentAfterDeletion(positionsByRowCopyWithoutNumber, forPosition, number, SubSegmentType.COLUMN);         }          if (!columnSubSegmentFillingResult.isValid()) {             return new PossibleNumberValidationResult(forPosition, number, false, null);         }          SubSegmentFillingResult rowSubSegmentFillingResult = new SubSegmentFillingResult(SubSegmentType.ROW);         rowSubSegmentFillingResult.setValid(true);         if (!positionsByColumnCopyWithoutNumber.isEmpty()) {             rowSubSegmentFillingResult = validateSubSegmentAfterDeletion(positionsByColumnCopyWithoutNumber, forPosition, number, SubSegmentType.ROW);         }          if (!rowSubSegmentFillingResult.isValid()) {             return new PossibleNumberValidationResult(forPosition, number, false, null);         }          SubSegmentFillingResult squareSubSegmentFillingResult = new SubSegmentFillingResult(SubSegmentType.SQUARE);         squareSubSegmentFillingResult.setValid(true);         if (!positionsBySquareCopyWithoutNumber.isEmpty()) {             squareSubSegmentFillingResult = validateSubSegmentAfterDeletion(positionsBySquareCopyWithoutNumber, forPosition, number, SubSegmentType.SQUARE);         }          if (!squareSubSegmentFillingResult.isValid()) {             return new PossibleNumberValidationResult(forPosition, number, false, null);         }          if (squareSubSegmentFillingResult.variantsAreEmpty() || columnSubSegmentFillingResult.variantsAreEmpty() || rowSubSegmentFillingResult.variantsAreEmpty()) {             if (squareSubSegmentFillingResult.variantsAreEmpty() &amp;&amp; columnSubSegmentFillingResult.variantsAreEmpty() &amp;&amp; rowSubSegmentFillingResult.variantsAreEmpty()) {                 return new PossibleNumberValidationResult(forPosition, number, true, null);             }              if (squareSubSegmentFillingResult.variantsAreEmpty()) {                 if (!rowSubSegmentFillingResult.variantsAreEmpty() &amp;&amp; !columnSubSegmentFillingResult.variantsAreEmpty()) {                     List&lt;SegmentValidBatch&gt; validBatches = getValidBatchesForColumnAndRow(columnSubSegmentFillingResult, rowSubSegmentFillingResult, positionsIntersectionsWithSquare);                     if (validBatches.isEmpty()) {                         return new PossibleNumberValidationResult(forPosition, number, false, null);                     }                     return new PossibleNumberValidationResult(forPosition, number, true, validBatches);                 }                  if (!rowSubSegmentFillingResult.variantsAreEmpty()) {                     List&lt;SegmentValidBatch&gt; validBatches = getValidBatchesForColumnOrRow(columnSubSegmentFillingResult);                     if (validBatches.isEmpty()) {                         return new PossibleNumberValidationResult(forPosition, number, false, null);                     }                     return new PossibleNumberValidationResult(forPosition, number, true, validBatches);                 }                  List&lt;SegmentValidBatch&gt; validBatches = getValidBatchesForColumnOrRow(columnSubSegmentFillingResult);                 if (validBatches.isEmpty()) {                     return new PossibleNumberValidationResult(forPosition, number, false, null);                 }                 return new PossibleNumberValidationResult(forPosition, number, true, validBatches);             }              if (!rowSubSegmentFillingResult.variantsAreEmpty()) {                 List&lt;SegmentValidBatch&gt; validBatches = getValidBatchesForColumnOrRowAndSquare(columnSubSegmentFillingResult, squareSubSegmentFillingResult, positionsIntersectionsWithSquare);                 if (validBatches.isEmpty()) {                     return new PossibleNumberValidationResult(forPosition, number, false, null);                 }                 return new PossibleNumberValidationResult(forPosition, number, true, validBatches);             }              List&lt;SegmentValidBatch&gt; validBatches = getValidBatchesForColumnOrRowAndSquare(columnSubSegmentFillingResult, squareSubSegmentFillingResult, positionsIntersectionsWithSquare);             if (validBatches.isEmpty()) {                 return new PossibleNumberValidationResult(forPosition, number, false, null);             }             return new PossibleNumberValidationResult(forPosition, number, true, validBatches);         }          List&lt;SegmentValidBatch&gt; validBatches = getValidBatchesForColumnRowAndSquare(columnSubSegmentFillingResult, rowSubSegmentFillingResult,                 squareSubSegmentFillingResult,                 positionsIntersectionsWithSquare);          if (validBatches.isEmpty()) {             return new PossibleNumberValidationResult(forPosition, number, false, null);         }          return new PossibleNumberValidationResult(forPosition, number, true, validBatches);     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 &#8212; \u043e positionsIntersectionsWithSquare. \u041d\u0438 \u0434\u043b\u044f \u043a\u043e\u0433\u043e \u043d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u0438\u043c\u0435\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c \u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u041d\u0430\u043c \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 &#8212; \u0437\u0430\u0447\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0438 \u0441\u0442\u0440\u043e\u043a\u0438? \u041f\u043e\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0438\u0445 \u0438\u0437 \u043f\u043e\u0434\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u044f\u0447\u0435\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0441\u043e\u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c. \u041f\u043e\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u0445 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430. \u0417\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u0449\u0438\u0439 \u0431\u043b\u043e\u043a, \u0433\u0434\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u0415\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u043a\u0432\u0430\u0434\u0440\u0430\u0442 &#8212; \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0441\u0442\u043e\u043b\u0431\u0435\u0446. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043b\u0438\u0431\u043e \u0441\u0442\u043e\u043b\u0431\u0435\u0446 &#8212; \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u043c. \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0432\u0441\u0435 &#8212; \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043a\u0432\u0430\u0434\u0440\u0430\u0442. \u0418 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f. \u0412\u0441\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e \u0441\u043e\u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044e \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043d\u0438\u0436\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0420\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441\u043e\u043e\u0442\u043d\u0435\u0441\u0435\u043d\u0438\u044f<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private List&lt;SegmentValidBatch&gt; getValidBatchesForColumnOrRow(SubSegmentFillingResult subSegmentFillingResult) {         List&lt;SegmentValidBatch&gt; result = new ArrayList&lt;&gt;();          Set&lt;CellsVariant&gt; subSegmentVariants = variantsToCells(subSegmentFillingResult);          if (Objects.equals(subSegmentFillingResult.getType(), SubSegmentType.ROW)) {             for (CellsVariant subSegmentVariant : subSegmentVariants) {                 result.add(new SegmentValidBatch(null, subSegmentVariant, null));             }         } else if (Objects.equals(subSegmentFillingResult.getType(), SubSegmentType.COLUMN)) {             for (CellsVariant subSegmentVariant : subSegmentVariants) {                 result.add(new SegmentValidBatch(subSegmentVariant, null, null));             }         } else {             throw new RuntimeException(\"Wrong type\");         }          return result;     }      private List&lt;SegmentValidBatch&gt; getValidBatchesForColumnAndRow(SubSegmentFillingResult columnSubSegmentFillingResult,                                                                    SubSegmentFillingResult rowSubSegmentFillingResult,                                                                    Set&lt;Position&gt; positionsIntersectionsWithSquare) {         List&lt;SegmentValidBatch&gt; result = new ArrayList&lt;&gt;();          if (!Objects.equals(columnSubSegmentFillingResult.getType(), SubSegmentType.COLUMN) || !Objects.equals(rowSubSegmentFillingResult.getType(), SubSegmentType.ROW)) {             throw new RuntimeException(\"Wrong type\");         }          Set&lt;CellsVariant&gt; columnSubSegmentVariants = variantsToCells(columnSubSegmentFillingResult);         Set&lt;CellsVariant&gt; rowSubSegmentVariants = variantsToCells(rowSubSegmentFillingResult);          for (CellsVariant columnSubSegmentVariant : columnSubSegmentVariants) {             Set&lt;Integer&gt; intersectionsWithSquareForColumn = columnSubSegmentVariant.getCells().stream().filter(cell -&gt; positionsIntersectionsWithSquare.contains(cell.position())).map(Cell::number).collect(Collectors.toSet());              for (CellsVariant rowSubSegmentVariant : rowSubSegmentVariants) {                 Set&lt;Integer&gt; intersectionsWithSquareForRow = rowSubSegmentVariant.getCells().stream().filter(cell -&gt; positionsIntersectionsWithSquare.contains(cell.position())).map(Cell::number).collect(Collectors.toSet());                 intersectionsWithSquareForRow.retainAll(intersectionsWithSquareForColumn);                  if (!intersectionsWithSquareForRow.isEmpty()) {                     continue;                 }                  result.add(new SegmentValidBatch(columnSubSegmentVariant, rowSubSegmentVariant, null));             }         }          return result;     }      private List&lt;SegmentValidBatch&gt; getValidBatchesForColumnOrRowAndSquare(SubSegmentFillingResult subSegmentFillingResult,                                                                            SubSegmentFillingResult squareSubSegmentFillingResult,                                                                            Set&lt;Position&gt; positionsIntersectionsWithSquare) {         \/\/ todo \u0442\u0443\u0442 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0435\u0449\u0435 \u0440\u0430\u0437, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u043f\u043e\u0435 \u043f\u044f\u0442\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438\/\u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0441 \u043d\u0438\u043c. \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0438 possibleNumbers \u0434\u043b\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u043a \u0431\u044b\u0442\u044c \u0435\u0449\u0435 \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u043e\u0442\u043e\u043c???         List&lt;SegmentValidBatch&gt; result = new ArrayList&lt;&gt;();          Set&lt;CellsVariant&gt; subSegmentVariants = variantsToCells(subSegmentFillingResult);         Set&lt;CellsVariant&gt; squareSubSegmentVariants = variantsToCells(squareSubSegmentFillingResult);          if (!Objects.equals(subSegmentFillingResult.getType(), SubSegmentType.COLUMN) &amp;&amp; !Objects.equals(subSegmentFillingResult.getType(), SubSegmentType.ROW)) {             throw new RuntimeException(\"Wrong type\");         }          if (!Objects.equals(squareSubSegmentFillingResult.getType(), SubSegmentType.SQUARE)) {             throw new RuntimeException(\"Wrong type\");         }          boolean isRow = subSegmentFillingResult.getType() == SubSegmentType.ROW;          for (CellsVariant subSegmentVariant : subSegmentVariants) {             Set&lt;Integer&gt; intersectionsWithSquare = subSegmentVariant.getCells().stream().filter(cell -&gt; positionsIntersectionsWithSquare.contains(cell.position())).map(Cell::number).collect(Collectors.toSet());              for (CellsVariant squareSubSegmentVariant : squareSubSegmentVariants) {                 boolean hasDupes = squareSubSegmentVariant.getCells().stream().map(Cell::number).anyMatch(intersectionsWithSquare::contains);                 if (hasDupes) {                     continue;                 }                 if (isRow) {                     result.add(new SegmentValidBatch(null, squareSubSegmentVariant, squareSubSegmentVariant));                     continue;                 }                 result.add(new SegmentValidBatch(squareSubSegmentVariant, null, squareSubSegmentVariant));             }         }          return result;     }      private List&lt;SegmentValidBatch&gt; getValidBatchesForColumnRowAndSquare(SubSegmentFillingResult columnSubSegmentFillingResult,                                                                          SubSegmentFillingResult rowSubSegmentFillingResult,                                                                          SubSegmentFillingResult squareSubSegmentFillingResult,                                                                          Set&lt;Position&gt; positionsIntersectionsWithSquare) {         List&lt;SegmentValidBatch&gt; result = new ArrayList&lt;&gt;();          Set&lt;CellsVariant&gt; columnSubSegmentVariants = variantsToCells(columnSubSegmentFillingResult);         Set&lt;CellsVariant&gt; rowSubSegmentVariants = variantsToCells(rowSubSegmentFillingResult);         Set&lt;CellsVariant&gt; squareSubSegmentVariants = variantsToCells(squareSubSegmentFillingResult);          if (!Objects.equals(columnSubSegmentFillingResult.getType(), SubSegmentType.COLUMN) || !Objects.equals(rowSubSegmentFillingResult.getType(), SubSegmentType.ROW)) {             throw new RuntimeException(\"Wrong type\");         }          if (!Objects.equals(squareSubSegmentFillingResult.getType(), SubSegmentType.SQUARE)) {             throw new RuntimeException(\"Wrong type\");         }          for (CellsVariant columnSubSegmentVariant : columnSubSegmentVariants) {             Set&lt;Integer&gt; intersectionsWithSquareByColumn = columnSubSegmentVariant.getCells().stream().filter(cell -&gt; positionsIntersectionsWithSquare.contains(cell.position())).map(Cell::number).collect(Collectors.toSet());              for (CellsVariant rowSubSegmentVariant : rowSubSegmentVariants) {                 Set&lt;Integer&gt; intersectionsWithSquareByRow = rowSubSegmentVariant.getCells().stream().filter(cell -&gt; positionsIntersectionsWithSquare.contains(cell.position())).map(Cell::number).collect(Collectors.toSet());                  Set&lt;Integer&gt; intersectionsByRowAndColumn = new HashSet&lt;&gt;(intersectionsWithSquareByRow);                 intersectionsByRowAndColumn.retainAll(intersectionsWithSquareByColumn);                  if (!intersectionsByRowAndColumn.isEmpty()) {                     continue;                 }                  for (CellsVariant squareSubSegmentVariant : squareSubSegmentVariants) {                     Set&lt;Integer&gt; intersectedNumbersInRowColumnForSquare = new HashSet&lt;&gt;(intersectionsWithSquareByColumn);                     intersectedNumbersInRowColumnForSquare.addAll(intersectionsWithSquareByRow);                      boolean hasDupesForSquare = squareSubSegmentVariant.getCells().stream().map(Cell::number).anyMatch(intersectedNumbersInRowColumnForSquare::contains);                     if (hasDupesForSquare) {                         continue;                     }                      result.add(new SegmentValidBatch(columnSubSegmentVariant, rowSubSegmentVariant, squareSubSegmentVariant));                 }             }         }          return result;     }      private Set&lt;CellsVariant&gt; variantsToCells(SubSegmentFillingResult fillingResult) {         return fillingResult.getNumberSequenceVariant().getKeyValuePairs().stream().map(                 setOfPairs -&gt; setOfPairs.stream().map(pair -&gt; new Cell(pair.getKey(), pair.getValue())).collect(Collectors.toSet())         ).map(r -&gt; new CellsVariant(r, fillingResult.getType())).collect(Collectors.toSet());     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0421 possibleNumberValidation, \u043f\u043e\u0445\u043e\u0436\u0435, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c!<\/p>\n<h2>\u0427\u0442\u043e \u0438\u043c\u0435\u0435\u043c?<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432 PossibleNumbersValidationResult \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u0430 \u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0446\u0438\u0444\u0440\u0430 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 &#171;\u043e\u043f\u043e\u0440\u043d\u043e\u0439&#187; \u043f\u043e\u0437\u0438\u0446\u0438\u0438 &#8212; \u0438 \u0432\u0441\u0435 SegmentValidBatch \u043f\u043e\u0434 \u043d\u0435\u0435, \u0442.\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0438 \u0446\u0438\u0444\u0440\u0443 \u0432 &#171;\u043e\u043f\u043e\u0440\u043d\u043e\u0439&#187; \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0442\u0435\u043f\u0435\u0440\u044c).<\/p>\n<p>\u041a\u0430\u043a \u044f \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b: \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u043a\u0443\u0441\u043a\u043e\u0432 \u043f\u0430\u0437\u0437\u043b\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a-\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432\u043e\u0435\u0434\u0438\u043d\u043e.<\/p>\n<p>\u042f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u043f\u043e\u0434\u0431\u043e\u0440 \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 &#171;\u042d\u0432\u0435\u0440\u0435\u0441\u0442\u0435&#187; \u043e\u0442 \u0431\u0435\u0437\u0443\u043c\u043d\u043e\u0433\u043e \u0444\u0438\u043d\u0441\u043a\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0410\u0440\u0442\u043e \u0418\u043d\u043a\u0430\u043b\u0430. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u043a\u0443\u0441\u043e\u0447\u043a\u043e\u0432 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0435 \u043c\u043d\u043e\u0433\u043e (\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0438 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b). \u0412\u0441\u0435\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043c\u043d\u044e, \u0438\u0445 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043e\u043a\u043e\u043b\u043e 80 \u0442\u044b\u0441\u044f\u0447. \u041d\u043e \u0447\u0442\u043e \u043e\u0431\u043d\u0430\u0434\u0435\u0436\u0438\u0432\u0430\u0435\u0442 &#8212; \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0435\u0440\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u0438 \u043a\u0443\u0447\u0438 \u043c\u0443\u0441\u043e\u0440\u0430. \u0417\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e-\u0442\u043e \u043e\u0442\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0441\u0435 \u0436\u0435 \u0432\u044b\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e. \u0412 \u0442\u0443\u043f\u0443\u044e \u043f\u0440\u044f\u043c\u044b\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c &#8212; \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u0435\u043d\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043d\u0435\u0431\u0435\u0437\u044b\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435, \u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0432\u0438\u0441\u0442\u043e\u043f\u043b\u044f\u0441\u043a\u0438 \u0441 Index-\u0430\u043c\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u043c, \u043e \u0447\u0435\u043c \u044f \u043f\u043e\u043a\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u0430\u043d\u0443: \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0433\u0430 \u0437\u0430\u0432\u0438\u0441\u0430\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043b\u043e\u043f\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u0435 \u0438 \u044f \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e \u043c\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u0438.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a-\u0442\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043c\u043e\u0438 \u0437\u0430\u0434\u0443\u043c\u043a\u0438 \u043f\u043e &#171;\u0438\u043d\u0434\u0435\u043a\u0430\u043c&#187; \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c X, \u0441\u043a\u0430\u0436\u0435\u043c&#8230; \u043d\u043e \u044d\u0442\u043e \u043c\u044b\u0441\u043b\u0438 \u0432\u0441\u043b\u0443\u0445.<\/p>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0438\u0445 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u0439 \u0442\u0430\u043a\u043e\u0439. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442 \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438 \u0438\u0445 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c.<\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u0438, \u043a\u0430\u043a \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c\/\u043e\u0431\u044b\u0433\u0440\u0430\u0442\u044c. \u0410\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u043d\u0435\u0434\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c \u043a\u0443\u0441\u043a\u043e\u043c Index-\u0430 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e <a href=\"https:\/\/github.com\/igorsmolka\/sudoku-public\" rel=\"noopener noreferrer nofollow\">\u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u0440\u0435\u043f\u0435 \u0441 \u043d\u0435\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u043f\u043e\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u043c<\/a>. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0441\u0435 \u043d\u0435\u0446\u0435\u043d\u0437\u0443\u0440\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u044f \u043e\u0442\u0442\u0443\u0434\u0430 \u043f\u043e\u0443\u0431\u0438\u0440\u0430\u043b&#8230;<\/p>\n<p>\u0412\u0441\u0435\u043c \u0434\u0437\u044f\u043a\u0443\u044e! \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/878124\/\"> https:\/\/habr.com\/ru\/articles\/878124\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0439 NP-\u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 &#8212; \u044d\u0442\u043e \u0446\u0435\u043b\u044c \u0430\u043c\u0431\u0438\u0446\u0438\u043e\u0437\u043d\u0430\u044f, \u043f\u0430\u0445\u043d\u0443\u0449\u0430\u044f \u0441\u043b\u0430\u0432\u043e\u0439 \u0438 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u043c\u0438 \u0434\u0435\u043d\u044c\u0433\u0430\u043c\u0438. \u041a\u0430\u043a \u0440\u0430\u0437 \u043a \u0442\u0430\u043a\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0421\u0443\u0434\u043e\u043a\u0443, \u0438 \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0432\u043e\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438 \u044f \u0433\u043e\u0440\u0435\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u0430 (\u043f\u043e \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f\u043c) \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u0435\u043b\u0430, \u0438 \u0445\u043e\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438 \u0432\u044b\u0448\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f-\u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e) &#8212; \u0434\u0435\u043b\u043e \u0435\u0449\u0435 \u0434\u0430\u043b\u0435\u043a\u043e \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f, \u0442.\u043a. \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043d\u0430\u0441\u0442\u0430\u043b &#171;\u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0438\u0439 \u0442\u0443\u043f\u0438\u043a&#187;. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0438 \u043d\u0430 \u0441\u0432\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u044b\u043b\u0438\u0437\u0430\u043d\u044b + \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 Java, \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043d\u0430 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u044f\u0437\u044b\u043a \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0441 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0431\u0435\u0434\u043e\u0439 \u043d\u0430 Java. \u041f\u043e\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0432\u0430\u0440\u0438\u0432\u0430\u0435\u0442\u0435 Java \u0438 \u0432\u0441\u044f\u043a\u0438\u0435 \u0442\u0430\u043c \u0441\u0442\u0440\u0438\u043c\u044b &#8212; \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442.<\/p>\n<p>\u041f\u0438\u0448\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0442\u043e\u0433\u0438 \u044d\u0442\u043e\u0439 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0448\u0430\u0433\u0430\u0445. \u041d\u0443, \u043c\u043e\u0436\u0435\u0442, \u043a\u043e\u043c\u0443-\u0442\u043e \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<h2>\u0428\u0430\u0433 0. \u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c<\/h2>\n<p>\u041d\u0430\u0447\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441 \u043e\u0431\u0449\u0435\u0439 \u0441\u0443\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u042d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432\u0441\u043b\u0435\u043f\u0443\u044e \u0438\u043b\u0438 \u0432 \u043f\u043e\u043b\u0443-\u0441\u043b\u0435\u043f\u0443\u044e. \u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u0435 &#171;\u043a\u0443\u0441\u043e\u0447\u043a\u0438&#187; \u044d\u0442\u043e\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u043b\u044f, \u0438 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043b\u0438\u0448\u044c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043a\u0443\u0441\u043e\u0447\u043a\u0438 \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0437\u0437\u043b.<\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0441 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u00ab\u043e\u043f\u043e\u0440\u043d\u044b\u0445\u00bb \u0442\u043e\u0447\u0435\u043a \u0434\u043b\u044f\u00a0\u0430\u043d\u0430\u043b\u0438\u0437\u0430.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u00a0\u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u043b\u044f &#8212; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u0447\u0435\u043a \u0438 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u043b\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0438\u0445. \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; \u044d\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u043e\u0440\u043d\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0443, \u0442\u043e\u0442 \u0436\u0435 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 (\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 <em>\u0441\u0435\u0433\u043c\u0435\u043d\u0442<\/em> \u0432 \u043c\u043e\u0435\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438).<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u00ab\u043e\u043f\u043e\u0440\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430\u00bb\u00a0\u2014 \u044d\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430\/\u0441\u0442\u043e\u043b\u0431\u0435\u0446. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043b\u0435:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c &#171;\u0447\u0438\u0441\u0442\u043e\u0435&#187; \u0441\u0443\u0434\u043e\u043a\u0443, \u0442.\u043a. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c &gt; 1, \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/figcaption><\/div>\n<\/figure>\n<p>\u043e\u043f\u043e\u0440\u043d\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 0.0, 1.3, 2.1, 3.2 (\u0441\u0447\u0435\u0442 \u0441 \u043d\u0443\u043b\u044f).<\/p>\n<p>\u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u043c\u0441\u044f \u043a\u00a0\u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a, \u0430\u00a0\u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439\u00a0\u2014 \u0438 \u044d\u0442\u043e \u043f\u0440\u0438\u00a0\u043f\u043e\u043b\u043d\u043e\u043c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044f.<\/p>\n<p>\u041e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u0431\u043e\u0440 \u044d\u0442\u0438\u0445 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0432\u00a0\u043a\u043e\u0434\u0435\u00a0\u2014 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435; \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0431\u043e\u0440 \u043e\u043f\u043e\u0440\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a\u00a0\u2014 \u044d\u0442\u043e \u043d\u0435\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433, \u0445\u043e\u0442\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043d \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c.<\/p>\n<h2>\u0428\u0430\u0433 1. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u043f\u0443 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u0432.<\/h2>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u0444\u043e\u0440\u043c\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<p><strong>Position<\/strong> &#8212; \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u043f\u043e\u043b\u0435. \u041d\u0438\u0447\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, row \u0434\u0430 column &#8212; \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441 \u043d\u0443\u043b\u044f.<\/p>\n<p><strong>PositionPotential <\/strong>&#8212; \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f, \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0412\u0430\u0436\u043d\u0430\u044f \u043c\u0435\u0442\u0430-\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f <em>possibleNumbers<\/em> &#8212; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0430\/\u0441\u0442\u043e\u043b\u0431\u0435\u0446\/\u043a\u0432\u0430\u0434\u0440\u0430\u0442 (\u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u0434\u043b\u044f 0.0 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 2,3,4 &#8212; 1 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c, \u0442.\u043a. \u043e\u043d\u0430 \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0438\u0437\u0443 \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435 0); <em>squareIndex<\/em> &#8212; \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043f\u043e\u043b\u044f (\u0434\u043b\u044f 2.1, \u0441\u043a\u0430\u0436\u0435\u043c, \u044d\u0442\u043e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0443\u0434\u0435\u0442 2); <em>segmentInfo <\/em> &#8212; \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0441\u0430\u043c\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c &#8212; \u044d\u0442\u043e <em>segmentPositions<\/em> (\u0434\u043b\u044f 2.1, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 0.1, 1.1, 2.0, 2.2, 2.3, 3.1, \u0442.\u0435. \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u044d\u0442\u043e\u0439 \u043f\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443).<\/p>\n<p><strong>Cell <\/strong>&#8212; \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0438 \u0441 \u0447\u0438\u0441\u043b\u043e\u043c. position, number &#8212; \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u0415\u0441\u043b\u0438 number \u043f\u0443\u0441\u0442\u043e\u0435 &#8212; \u043f\u043e\u043b\u0435 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e.<\/p>\n<p><strong>Sudoku \u0438 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f SudokuImpl <\/strong>&#8212; \u043a\u043b\u0430\u0441\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u043d\u0435\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 n &#8212; \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 field &#8212; \u043d\u0430\u0448\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435.<\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>Position<\/strong><\/p>\n<pre><code class=\"java\">public record Position(         int row,         int column ) {      \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<p><strong>SegmentInfo<\/strong><\/p>\n<pre><code class=\"java\">import java.util.HashSet; import java.util.Objects; import java.util.Set;  public record SegmentInfo(Position startingPoint,                           Set&lt;Integer&gt; possibleNumbers,                           Set&lt;Position&gt; segmentPositions) {     \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<p><strong>PositionPotential<\/strong><\/p>\n<pre><code class=\"java\">import java.util.HashSet; import java.util.Set;  public class PositionPotential {      private final Set&lt;Integer&gt; possibleNumbers;      private SegmentInfo segmentInfo;      private int squareIndex;      public PositionPotential(int possibleNumber) {         Set&lt;Integer&gt; setWithSingleNumber = new HashSet&lt;&gt;();         setWithSingleNumber.add(possibleNumber);          this.possibleNumbers = setWithSingleNumber;     }      public PositionPotential(Set&lt;Integer&gt; possibleNumbers, int squareIndex) {         this.possibleNumbers = possibleNumbers;         this.squareIndex = squareIndex;     }      public PositionPotential(Set&lt;Integer&gt; possibleNumbers, SegmentInfo segmentInfo, int squareIndex) {         this.possibleNumbers = possibleNumbers;         this.segmentInfo = segmentInfo;         this.squareIndex = squareIndex;     }      \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0447\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<p><strong>Cell<\/strong><\/p>\n<pre><code class=\"java\">public record Cell(         Position position,         Integer number ) {     public boolean isEmpty() {         return number == null;     }     \/\/ \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0447\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">public interface Sudoku {      int[][] getVariant();      boolean checkVariant(int[][] variant); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0421 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b field \u0432\u0441\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 &#8212; \u043f\u0443\u0441\u0442\u044b\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 &#8212; \u0438 \u043f\u043e \u043d\u0438\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u043f\u0443 \u0438\u0437 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b, \u043e\u043d \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u044b\u0439 &#8212; \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u043a\u043e\u0434\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"java\">Set&lt;Cell&gt; cells = getCells(this.field); Map&lt;Position, PositionPotential&gt; positionPotentialMap = createNewPotentialMapForCells(cells);<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0435\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 &#171;\u043e\u043f\u043e\u0440\u043d\u044b\u0435&#187; \u0442\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a.<\/p>\n<details class=\"spoiler\">\n<summary>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u0440\u0438\u0432\u043e\u0432\u0430\u0442\u043e, \u043d\u043e \u0432\u0440\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">private Set&lt;Position&gt; getPositionsForAnalyze(Map&lt;Position, PositionPotential&gt; positionPotentialMap) {         Set&lt;Position&gt; result = new HashSet&lt;&gt;();          \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438         Set&lt;Integer&gt; rowsToFeel = positionPotentialMap.keySet().stream().map(Position::row).collect(Collectors.toSet());          \/\/ \u0442.\u043a. \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u043c\u0430\u043f\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 - \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0435 \u043a\u043e\u043f\u0438\u044e         Map&lt;Position, PositionPotential&gt; positionPositionPotentialCopy = copyOfPotentialMap(positionPotentialMap);          for (int row : rowsToFeel) {             \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439; \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0445 \u043d\u0435\u0442 - \u0434\u043e\u0443\u0434\u0430\u043b\u044f\u043b\u0438\u0441\u044c. \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043c\u0430\u043f\u0443, \u043e\u0442\u043a\u0438\u043d\u0443\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u043e\u0440\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438.             Position firstPositionWithRow = positionPositionPotentialCopy.keySet().stream().filter(p -&gt; p.row() == row).findFirst().orElse(null);             if (firstPositionWithRow == null) {                 positionPositionPotentialCopy = copyOfPotentialMap(positionPotentialMap);                 for (Position position : result) {                     positionPositionPotentialCopy.remove(position);                 }                 firstPositionWithRow = positionPositionPotentialCopy.keySet().stream().filter(p -&gt; p.row() == row).findFirst().orElseThrow();             }              \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435             result.add(firstPositionWithRow);              Set&lt;Position&gt; positionsToDelete = new HashSet&lt;&gt;();             positionsToDelete.add(firstPositionWithRow);              int squareOfPosition = positionPositionPotentialCopy.get(firstPositionWithRow).getSquareIndex();              \/\/ \u0432\u0441\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0443, \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f - \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u043b\u0438\u0431\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438             Position finalFirstPositionWithRow = firstPositionWithRow;             Set&lt;Position&gt; connectedPositions = positionPositionPotentialCopy.entrySet().stream().filter(es -&gt; {                 Position position = es.getKey();                 PositionPotential positionPotential = es.getValue();                  return position.row() == finalFirstPositionWithRow.row() || position.column() == finalFirstPositionWithRow.column() || positionPotential.getSquareIndex() == squareOfPosition;             }).map(Map.Entry::getKey).collect(Collectors.toSet());              \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c             positionsToDelete.addAll(connectedPositions);              for (Position positionToDelete : positionsToDelete) {                 positionPositionPotentialCopy.remove(positionToDelete);             }         }          return result;     }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<pre><code class=\"java\">Set&lt;Position&gt; positionsToAnalyze = getPositionsForAnalyze(positionPotentialMap);<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, &#171;\u043e\u043f\u043e\u0440\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438&#187; \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0435.<\/p>\n<h2>\u0428\u0430\u0433 2. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f, \u043f\u043e\u0434\u0431\u043e\u0440 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432<\/h2>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p><strong>PossibleNumbersValidationResult &#8212;<\/strong> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442; \u0432\u0430\u043b\u0438\u0434\u043d\u043e\/\u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e &#8212; \u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0438\u0431\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u043d\u0443 \u044f\u0447\u0435\u0439\u043a\u0443 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c); \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 &#8212; \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0446\u0438\u0444\u0435\u0440\u0438.<\/p>\n<p><strong>PossibleNumberValidationResult &#8212;<\/strong> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442; \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u0446\u0438\u0444\u0435\u0440\u0438; \u0432\u0430\u043b\u0438\u0434\u043d\u043e\/\u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e &#8212; \u0432\u0435\u0442\u043a\u0438 \u0441 \u044d\u0442\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0432 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c). \u0418 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0438\u0437 <em>SegmentValidBatch,<\/em> \u043e \u043d\u0435\u043c \u043d\u0438\u0436\u0435.<\/p>\n<p><strong>CellsVariant &#8212; <\/strong>\u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u044f (\u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430). \u041f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 Cell, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0442\u0438\u043f\u043e\u043c ROW, COLUMN \u0438\u043b\u0438 SQUARE.<\/p>\n<p><strong>SegmentValidBatch &#8212;<\/strong> \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u0430\u043a \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043e\u043f\u043e\u0440\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443). \u0418\u043c\u0435\u0435\u0442 \u0442\u0440\u0438 CellsVariant &#8212; \u0441\u0442\u0440\u043e\u043a\u0430, \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043a\u0432\u0430\u0434\u0440\u0430\u0442.<\/p>\n<p>\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0431\u0441\u043d\u0430, \u0432\u043e\u0442<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>PossibleNumbersValidationResult <\/strong><\/p>\n<pre><code class=\"java\">public record PossibleNumbersValidationResult(         Position<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-446638","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/446638","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=446638"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/446638\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=446638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=446638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=446638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}