{"id":282331,"date":"2016-12-12T09:15:03","date_gmt":"2016-12-12T06:15:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=282331"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=282331","title":{"rendered":"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0438\u0433\u0440\u044b 2048"},"content":{"rendered":"<p>2048 \u2014 \u0438\u0433\u0440\u0430 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0432 2014\u043e\u043c \u0433\u043e\u0434\u0443 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u0432\u0448\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0443\u0431\u0438\u0432\u0430\u043b\u043a\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0433\u0440\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043a\u043b\u043e\u043d\u043e\u0432, \u0431\u043e\u0442\u043e\u0432 \u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439. \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435. (<a href=\"https:\/\/habrahabr.ru\/post\/249371\/\">\u041a\u043b\u043e\u043d<\/a>, <a href=\"https:\/\/habrahabr.ru\/sandbox\/80123\/\">\u0431\u043e\u0442<\/a>, <a href=\"https:\/\/habrahabr.ru\/post\/223045\/\">\u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/a>) \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0438\u0433\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u043e\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/hsto.org\/files\/33b\/fd2\/92e\/33bfd292e89a4758b6205c2f502a9c47.png\" alt=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0433\u0440\u044b\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<p>\u0421\u0430\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u041f\u0435\u0440\u0432\u0430\u044f \u2014 \u044d\u0442\u043e \u0434\u0432\u0438\u0436\u043e\u043a \u043d\u0430 C++. \u0421 \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0433\u0440\u0430\u0442\u044c \u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043d \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443:<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0434\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435, \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e \u0434\u0432\u043e\u0439\u043a\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u044d\u0442\u0438\u0445 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<p>  <\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430 \u0438\u0433\u0440\u043e\u043a \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0443\u043f\u0438\u043a\u043e\u0432\u044b\u0439 \u0445\u043e\u0434 (\u0445\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f) \u0434\u0432\u0438\u0436\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0446\u0438\u043a\u043b:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0445\u043e\u0434 \u0438\u0433\u0440\u043e\u043a\u0430.<\/li>\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0445\u043e\u0434 \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435.<\/li>\n<li>\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u043e\u0432\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u0434\u0432\u043e\u0439\u043a\u0430 \u0438\u043b\u0438 \u0447\u0435\u0442\u0432\u0451\u0440\u043a\u0430) \u0438 \u0441\u0430\u043c\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/li>\n<\/ol>\n<p>  <\/li>\n<li>\u041f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044e \u0438\u0433\u0440\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0445\u043e\u0434\u043e\u0432, \u0441\u0447\u0451\u0442 \u0438 \u0432\u0440\u0435\u043c\u044f \u0438\u0433\u0440\u044b \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0434\u0432\u0438\u0436\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u0437 <em>board.hpp<\/em>. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">template&lt;int n&gt; class A{                  \/\/ \u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c n private:     int left_adder(int&amp;, int);            \/\/ 16 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 move     int left_compressor(int&amp;, int);       \/\/ \u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c namespace     int left_move_row(int);               \/\/ \u0411\u044b\u043b\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c 4 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430     int left_move();                      \/\/ \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c,     int right_adder(int&amp;, int);           \/\/ \u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0432 \u0442\u0430\u043a\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e     int right_compressor(int&amp;, int);      \/\/     int right_move_row(int);              \/\/     int right_move();                     \/\/     int up_adder(int&amp;, int);              \/\/     int up_compressor(int&amp;, int);         \/\/     int up_move_column(int);              \/\/     int up_move();                        \/\/     int down_adder(int&amp;, int);            \/\/     int down_compressor(int&amp;, int);       \/\/     int down_move_column(int);            \/\/     int down_move();                      \/\/     std::pair&lt;int,int&gt; random();          \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u0443\u0441\u0442\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f 2 \u0438\u043b\u0438 4     void out() const;                     \/\/ \u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b a. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 move(0)     unsigned score = 0;                   \/\/ \u0421\u0447\u0451\u0442     bool deadlock = false;                \/\/ \u0418\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u043f\u043e\u043b\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0445\u043e\u0434\u0430     static std::mt19937 rand;             \/\/ \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b     std::array&lt;std::array&lt;int,n&gt;,n&gt; a;    \/\/ \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u043e\u043b\u044f public:     A();                                  \/\/     std::vector&lt;int&gt; init();              \/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u0432\u0443\u0445 \u044f\u0447\u0435\u0435\u043a \u0441 \u0434\u0432\u043e\u0439\u043a\u0430\u043c\u0438     std::vector&lt;int&gt; move(int);           \/\/ \u0414\u0435\u043b\u0430\u0435\u0442 \u0445\u043e\u0434     unsigned get_score() const;           \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0447\u0451\u0442 };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u2014 \u044d\u0442\u043e \u0431\u043e\u0442, \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c. \u041e\u043d \u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0434\u0432\u0438\u0436\u043e\u043a (\u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0434\u0432\u0438\u0436\u043a\u0430 \u0438 \u0431\u043e\u0442\u0430), \u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0445\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c. \u0411\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u2014 \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0434 \u0432 \u0442\u0443\u043f\u0438\u043a\u043e\u0432\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 bash-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 &quot;\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442&quot; \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0432 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"primery-botov\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u043e\u0442\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 4 \u0431\u043e\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u044c \u043c\u043e\u0434\u0443\u043b\u044f <em>board<\/em> \u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439. \u0412 \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432 \u0443 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <em>deadlock<\/em>. \u0421 \u0434\u0432\u0438\u0436\u043a\u043e\u043c \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>main<\/em>.<\/p>\n<p>  <\/p>\n<p><strong>1. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440<\/strong><\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u0442 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0445\u043e\u0434. \u042d\u0442\u043e\u0442 \u0431\u043e\u0442 \u0441\u0434\u0435\u043b\u0430\u043d, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u043e\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 1250<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import random import board  def f(a):     l = [1, 2, 3, 4]     ans = random.choice(l)     while a.deadlock(ans) and l != []:         ans = random.choice(l)         del l[l.index(ans)]     if l == [] and a.deadlock(ans):         ans = 0     return ans  board.main(f)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><strong>2. \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u0440\u0443\u0433\u0443<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0441\u0432\u043e\u0438\u043c \u0445\u043e\u0434\u043e\u043c \u0431\u043e\u0442 \u0434\u0435\u043b\u0430\u0435\u0442 \u0445\u043e\u0434 \u0432\u0432\u0435\u0440\u0445, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434 \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044f \u0442\u0443\u043f\u0438\u043a\u043e\u0432\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2900<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import board  def f(a):     global h     ans = h % 4 + 1     while a.deadlock(ans) and ans != h:         ans = ans % 4 + 1     h = ans     return h  h = 0 board.main(f)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><strong>3. \u0412\u0441\u0451 \u0432 \u043e\u0434\u0438\u043d \u0443\u0433\u043e\u043b<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0441\u0432\u043e\u0438\u043c \u0445\u043e\u0434\u043e\u043c \u0431\u043e\u0442 \u0434\u0435\u043b\u0430\u0435\u0442 \u0445\u043e\u0434 \u0432\u0432\u0435\u0440\u0445. \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0434\u0430 \u0432\u0432\u0435\u0440\u0445 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0445\u043e\u0434 \u0432\u043f\u0440\u0430\u0432\u043e, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0434\u0430 \u0432\u043f\u0440\u0430\u0432\u043e \u0445\u043e\u0434 \u0432\u0432\u0435\u0440\u0445. \u0415\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0445\u043e\u0434 \u0442\u0443\u043f\u0438\u043a\u043e\u0432\u044b\u0439, \u0442\u043e \u0431\u043e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0445\u043e\u0434. \u0415\u0441\u043b\u0438 \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0445\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0443\u043f\u0438\u043a\u043e\u0432\u044b\u043c, \u0442\u043e \u0431\u043e\u0442 \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0445\u043e\u0434 \u0432\u043b\u0435\u0432\u043e \u0438 \u0432 \u043a\u0440\u0430\u0439\u043d\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0445\u043e\u0434 \u0432\u043d\u0438\u0437.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 3900<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import board  def f(a):     global h     if h == 1:         l = [2, 1]     else:         l = [1, 2]     l += [4, 3, 0]     while a.deadlock(l[0]) and l[0] != 0:         l = l[1:]     h = l[0]     return h  h = 0 board.main(f)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><strong>4. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043e\u0447\u043a\u043e\u0432<\/strong><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0431\u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0445\u043e\u0434\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u043e\u0442 \u0438\u0437 \u043d\u0438\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043e\u0447\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 4000<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import board  def f(a):     max = 0     ans = 0     for i in range(1, 5):         if not a.deadlock(i):             b = a.copy()             t = b.move(i)             if (t &gt;= max):                 ans = i                 max = t     return ans  board.main(f)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h2 id=\"statistika\">\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438\u0441\u044c 1000 \u0440\u0430\u0437 \u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445.<\/p>\n<p>  <\/p>\n<table>\n<thead>\n<tr>\n<th>\u041d\u043e\u043c\u0435\u0440 \u0431\u043e\u0442\u0430<\/th>\n<th>\u0421\u0440\u0435\u0434\u043d. \u0448\u0430\u0433\u0438<\/th>\n<th>\u041c\u0438\u043d. \u0448\u0430\u0433\u0438<\/th>\n<th>\u041c\u0430\u043a\u0441. \u0448\u0430\u0433\u0438<\/th>\n<th>\u0421\u0440\u0435\u0434\u043d. c\u0447\u0451\u0442<\/th>\n<th>\u041c\u0438\u043d. \u0441\u0447\u0451\u0442<\/th>\n<th>\u041c\u0430\u043a\u0441. \u0441\u0447\u0451\u0442<\/th>\n<th>\u0421\u0440\u0435\u0434\u043d. \u0432\u0440\u0435\u043c\u044f<\/th>\n<th>\u041c\u0438\u043d. \u0432\u0440\u0435\u043c\u044f<\/th>\n<th>\u041c\u0430\u043a\u0441. \u0432\u0440\u0435\u043c\u044f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>131<\/td>\n<td>50<\/td>\n<td>266<\/td>\n<td>1259<\/td>\n<td>240<\/td>\n<td>3216<\/td>\n<td>90<\/td>\n<td>60<\/td>\n<td>242<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>233<\/td>\n<td>57<\/td>\n<td>647<\/td>\n<td>2885<\/td>\n<td>292<\/td>\n<td>11296<\/td>\n<td>108<\/td>\n<td>52<\/td>\n<td>234<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>311<\/td>\n<td>98<\/td>\n<td>859<\/td>\n<td>3905<\/td>\n<td>740<\/td>\n<td>14700<\/td>\n<td>155<\/td>\n<td>78<\/td>\n<td>363<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>317<\/td>\n<td>70<\/td>\n<td>826<\/td>\n<td>4027<\/td>\n<td>412<\/td>\n<td>13292<\/td>\n<td>776<\/td>\n<td>116<\/td>\n<td>2692<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/srbgd\/2048\">Github<\/a><\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/317370\/\"> https:\/\/habrahabr.ru\/post\/317370\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2048 \u2014 \u0438\u0433\u0440\u0430 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0432 2014\u043e\u043c \u0433\u043e\u0434\u0443 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u0432\u0448\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0443\u0431\u0438\u0432\u0430\u043b\u043a\u043e\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0433\u0440\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043a\u043b\u043e\u043d\u043e\u0432, \u0431\u043e\u0442\u043e\u0432 \u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439. \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435. (<a href=\"https:\/\/habrahabr.ru\/post\/249371\/\">\u041a\u043b\u043e\u043d<\/a>, <a href=\"https:\/\/habrahabr.ru\/sandbox\/80123\/\">\u0431\u043e\u0442<\/a>, <a href=\"https:\/\/habrahabr.ru\/post\/223045\/\">\u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/a>) \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0438\u0433\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u043e\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/hsto.org\/files\/33b\/fd2\/92e\/33bfd292e89a4758b6205c2f502a9c47.png\" alt=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0433\u0440\u044b\"\/><\/p>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-282331","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/282331","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=282331"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/282331\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}