{"id":3411,"date":"2017-12-10T01:12:11","date_gmt":"2017-12-09T22:12:11","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=3411"},"modified":"2017-12-11T00:44:51","modified_gmt":"2017-12-10T21:44:51","slug":"e-olymp-6129-%d0%b4%d0%b5%d0%ba-%d1%81-%d0%b7%d0%b0%d1%89%d0%b8%d1%82%d0%be%d0%b9-%d0%be%d1%82-%d0%be%d1%88%d0%b8%d0%b1%d0%be%d0%ba","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=3411","title":{"rendered":"e-olymp 6129. \u0414\u0435\u043a \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u043e\u0448\u0438\u0431\u043e\u043a"},"content":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0441 \u0441\u0430\u0439\u0442\u0430\u00a0<a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/6129\">e-olymp.com.<\/a><\/p>\n<p><strong><span style=\"text-decoration: underline\">\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/span><\/strong><\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 <em>&#171;\u0434\u0435\u043a&#187;<\/em>. \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0435\u043a\u0430 \u0438 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0434\u0435\u043a\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0432\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434\u044b. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<p><strong>push_front<\/strong><\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c) \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0434\u0435\u043a\u0430 \u043d\u043e\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <strong>ok<\/strong>.<\/p>\n<p><strong>push_back<\/strong><\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c) \u0432 \u043a\u043e\u043d\u0435\u0446 \u0434\u0435\u043a\u0430 \u043d\u043e\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <strong>ok<\/strong>.<\/p>\n<p><strong>pop_front<\/strong><\/p>\n<p>\u0418\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u0434\u0435\u043a\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p><strong>pop_back<\/strong><\/p>\n<p>\u0418\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u0434\u0435\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p><strong>front<\/strong><\/p>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044f \u0435\u0433\u043e). \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p><strong>back<\/strong><\/p>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044f \u0435\u0433\u043e). \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p><strong>size<\/strong><\/p>\n<p>\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0435\u043a\u0435.<\/p>\n<p><strong>clear<\/strong><\/p>\n<p>\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0434\u0435\u043a (\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b) \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <strong>ok<\/strong>.<\/p>\n<p><strong>exit<\/strong><\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 <strong>bye<\/strong> \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0434\u0435\u043a\u0435 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 100. \u041f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 pop_front, pop_back, front, back \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u0438 \u0432 \u0434\u0435\u043a\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f pop_front, pop_back, front, back, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0435\u043a \u043f\u0443\u0441\u0442, \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 error.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline\"><strong>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/span><br \/>\n\u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/span><br \/>\n\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p><span style=\"text-decoration: underline\"><strong>\u0422\u0435\u0441\u0442\u044b<\/strong><\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td>\u2116<\/td>\n<td>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>front<br \/>\nback<br \/>\npop_back<br \/>\npop_front<br \/>\nexit<\/td>\n<td>error<br \/>\nerror<br \/>\nerror<br \/>\nerror<br \/>\nbye<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>push_back 1<br \/>\nback<br \/>\nexit<\/td>\n<td>ok<br \/>\n1<br \/>\nbye<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>push_back 1<br \/>\npush_front 2<br \/>\nback<br \/>\nfront<br \/>\nsize<br \/>\nclear<br \/>\nsize<br \/>\npop_back<br \/>\nexit<\/td>\n<td>ok<br \/>\nok<br \/>\n1<br \/>\n2<br \/>\n2<br \/>\nok<br \/>\n0<br \/>\nerror<br \/>\nbye<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"text-decoration: underline\"><strong>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/strong><\/span><\/p>\n<pre class=\"lang:java decode:true \">import java.util.*;\r\nimport java.io.*;\r\n\r\nclass DequeException extends Exception {}\r\n\r\nclass Node &lt;T&gt;\r\n{\r\n\tT val;\r\n\tNode prev, next;\r\n\t\r\n\tNode(T v, Node p, Node n) {val = v; prev = p; next = n;}\r\n}\r\n\r\nclass MyDeque &lt;T&gt;\r\n{\r\n\tint size;\r\n\tNode&lt;T&gt; first, last;\r\n\t\r\n\tMyDeque() {\r\n\t\tsize = 0;\r\n\t\tfirst = null;\r\n\t\tlast = null;\r\n\t}\r\n\t\r\n\tString pushBack(T val) {\r\n\t\tif (size &gt; 0) {\r\n\t\t\tNode currentNode = new Node&lt;T&gt; (val, last, null);\r\n\t\t\tlast.next = currentNode;\r\n\t\t\tlast = currentNode;\r\n\t\t\tsize++;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tNode currentNode = new Node&lt;T&gt; (val, null, null);\r\n\t\t\tlast = currentNode;\r\n\t\t\tfirst = currentNode;\r\n\t\t\tsize++;\r\n\t\t}\r\n\t\treturn \"ok\";\r\n\t}\r\n\t\r\n\tString pushFront(T val) {\r\n\t\tif (size &gt; 0) {\r\n\t\t\tNode currentNode = new Node&lt;T&gt; (val, null, first);\r\n\t\t\tfirst.prev = currentNode;\r\n\t\t\tfirst = currentNode;\r\n\t\t\tsize++;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tNode currentNode = new Node&lt;T&gt; (val, null, null);\r\n\t\t\tlast = currentNode;\r\n\t\t\tfirst = currentNode;\r\n\t\t\tsize++;\r\n\t\t}\r\n\t\treturn \"ok\";\r\n\t}\r\n\t\r\n\tT popFront() throws DequeException {\r\n\t\tif(size == 0) throw new DequeException();\r\n\t\tT v = first.val;\r\n\t\tfirst = first.next;\r\n\t\tsize--;\r\n\t\treturn v;\r\n\t}\r\n\t\r\n\tT popBack() throws DequeException {\r\n\t\tif(size == 0) throw new DequeException();\r\n\t\tT v = last.val;\r\n\t\tlast = last.prev;\r\n\t\tsize--;\r\n\t\treturn v;\r\n\t}\r\n\t\r\n\tT front() throws DequeException {\r\n\t\tif(size == 0) throw new DequeException();\r\n\t\treturn first.val;\r\n\t}\r\n\t\r\n\tT back() throws DequeException {\r\n\t\tif(size == 0) throw new DequeException();\r\n\t\treturn last.val;\r\n\t}\r\n\t\r\n\tint getSize() {\r\n\t\treturn size;\r\n\t}\r\n\t\r\n\tString clear() {\r\n\t\tsize = 0;\r\n\t\treturn \"ok\";\r\n\t}\r\n\t\r\n\tString ex() {\r\n\t\treturn \"bye\";\r\n\t}\r\n}\r\n\r\nclass Main\r\n{\r\n\tpublic static void main (String[] args) {\r\n\t\tScanner in = new Scanner(System.in);\r\n\t\tPrintWriter out = new PrintWriter(System.out);\r\n\t\tMyDeque&lt;String&gt; deque = new MyDeque&lt;String&gt;();\r\n\t\tString s, val;\r\n\t\t\r\n\t\twhile(in.hasNext()) {\r\n\t\t\ts = in.next();\r\n\t\t\tif (s.equals(\"exit\")) out.println(deque.ex());\r\n\t\t\telse if (s.equals(\"clear\")) out.println(deque.clear());\r\n\t\t\telse if (s.equals(\"size\")) out.println(deque.getSize());\r\n\t\t\telse if (s.equals(\"back\")) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tout.println(deque.back());\r\n\t\t\t\t} catch(DequeException e) {\r\n\t\t\t\t\tout.println(\"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(s.equals(\"front\")) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tout.println(deque.front());\r\n\t\t\t\t} catch(DequeException e) {\r\n\t\t\t\t\tout.println(\"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (s.equals(\"pop_back\")) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tout.println(deque.popBack());\r\n\t\t\t\t} catch(DequeException e) {\r\n\t\t\t\t\tout.println(\"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (s.equals(\"pop_front\")) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tout.println(deque.popFront());\r\n\t\t\t\t} catch(DequeException e) {\r\n\t\t\t\t\tout.println(\"error\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(s.equals(\"push_back\")) {\r\n\t\t\t\tval = in.next();\r\n\t\t\t\tout.println(deque.pushBack(val));\r\n\t\t\t}\r\n\t\t\telse if(s.equals(\"push_front\")) {\r\n\t\t\t\tval = in.next();\r\n\t\t\t\tout.println(deque.pushFront(val));\r\n\t\t\t}\r\n\t\t\tout.flush();\t\r\n\t\t}\r\n\t}\r\n}<\/pre>\n<p><span style=\"text-decoration: underline\"><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/strong><\/span><\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 <em>&#171;\u0434\u0435\u043a&#187; <\/em>\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0432\u0443\u0441\u0432\u044f\u0437\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430. \u0412 \u043a\u043b\u0430\u0441\u0441\u0435\u00a0<code>MyDeque<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432\u0441\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u0422\u0435 \u0438\u0437 \u043d\u0438\u0445, \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445, \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 (&#171;ok&#187; \u0438\u043b\u0438 &#171;bye&#187;). \u041f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0434\u0435\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430\u00a0<code>DequeException<\/code>, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u00a0<code>Exception<\/code>. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>MyDeque<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 <em>&#171;error&#187;<\/em>.<\/p>\n<p>\u041a\u043e\u0434 \u043d\u0430\u00a0<a href=\"https:\/\/ideone.com\/LfoKO3\">ideone.com.<\/a><\/p>\n<p>\u0417\u0430\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0<a href=\"https:\/\/www.e-olymp.com\/ru\/submissions\/3810218\">e-olymp.com.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0441 \u0441\u0430\u0439\u0442\u0430\u00a0e-olymp.com. \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 &#171;\u0434\u0435\u043a&#187;. \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0435\u043a\u0430 \u0438 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0434\u0435\u043a\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0432\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434\u044b. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b: push_front \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c) \u0432 \u043d\u0430\u0447\u0430\u043b\u043e &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=3411\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":106,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[183,328,329,41],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3411"}],"collection":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/users\/106"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3411"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3411\/revisions"}],"predecessor-version":[{"id":3412,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3411\/revisions\/3412"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}