{"id":435,"date":"2020-05-11T13:21:31","date_gmt":"2020-05-11T05:21:31","guid":{"rendered":"http:\/\/nocriz.com\/?p=435"},"modified":"2021-09-08T20:20:07","modified_gmt":"2021-09-08T12:20:07","slug":"%e9%80%9a%e4%bf%a1%e9%a2%98_good-integer","status":"publish","type":"post","link":"https:\/\/nocriz.com\/?p=435","title":{"rendered":"\u901a\u4fe1\u9898_Good Integer"},"content":{"rendered":"\n<p>\u524d\u51e0\u5929\u592a\u9e3d\u4e86\uff0c\u6ca1\u600e\u4e48\u8001\u8001\u5b9e\u5b9e\u641e\u7ade\u8d5bQwQ\u2026\u2026Deadline\u5c06\u8fd1\uff0c\u6211\u53ea\u597d\u6765\u5206\u4eab\u4e00\u9053\u9898\u3002\u6211\u7684\u6570\u5b66\u6c34\u5e73\u5c1a\u4e14\u975e\u5e38\u6709\u9650\uff0c\u53ef\u80fd\u4e0d\u80fd\u7406\u89e3\u5176\u672c\u8d28\uff0c\u8fd8\u8bf7\u8c05\u89e3\u2026\u2026\u6709\u5927\u4f6c\u53ef\u4ee5\u6559\u6559\u6211\u2026\u2026<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u9898\u6709\u610f\u601d\u7684\u5730\u65b9\u5728\u4e8e\u573a\u4e0a\u53ea\u8fc7\u4e86\u4e00\u4e2a\u961f\uff0c\u800c\u8865\u9898\u5341\u5929\u540e\u4e5f\u53ea\u6709\u4e00\u4e2a\u961f\u8865\u4e86\u8fd9\u4e2a\u9898\uff08\uff1f\uff09\u5c3d\u7ba1\u8fd9\u4e2a\u9898\u597d\u50cf\u901a\u5e38\u6784\u9020\u65b9\u6cd5\u90fd\u884c\u4e0d\u901a\uff0c\u4f46\u662f\u8fd9\u4e2a\u9898\u5b9e\u5219\u4e0d\u96be\u2026\u2026\u53ef\u80fd\u4e3b\u8981\u95ee\u9898\u5728\u4e8e\u9898\u89e3\u5199\u7684\u4e0d\u591f\u597d\uff0c\u6216\u8005\u9009\u624b\u6ca1\u6709\u8865\u9898\u5174\u8da3\uff1f<\/p>\n\n\n\n<p>\u8fd9\u9053\u9898\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<div align=\"center\"><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/nocriz.com\/wp-content\/uploads\/2020\/05\/\u622a\u5c4f2020-05-11-\u4e0b\u534812.39.45.png\" alt=\"\" class=\"wp-image-436\" width=\"332\" height=\"334\" srcset=\"https:\/\/nocriz.com\/wp-content\/uploads\/2020\/05\/\u622a\u5c4f2020-05-11-\u4e0b\u534812.39.45.png 663w, https:\/\/nocriz.com\/wp-content\/uploads\/2020\/05\/\u622a\u5c4f2020-05-11-\u4e0b\u534812.39.45-298x300.png 298w, https:\/\/nocriz.com\/wp-content\/uploads\/2020\/05\/\u622a\u5c4f2020-05-11-\u4e0b\u534812.39.45-150x150.png 150w\" sizes=\"(max-width: 332px) 100vw, 332px\" \/><\/figure><\/div>\n\n\n\n<p>\u4e00\u4e2a\u5982\u56fe\u6240\u793a\u7684\u56fe\uff0c\u73b0\u5728\u8981\u6c42\u5c06\u4e00\u4e2a\u957f\u5ea6\u4e3a <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-cc4219bbfce4cdff91ef130369735350_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;&#32;&#92;&#108;&#101;&#32;&#51;&#48;&#48;&#48;&#48;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"115\" style=\"vertical-align: -3px;\"\/> \u768401\u5e8f\u5217\u8f6c\u6362\u4e3a\u4e00\u4e2a\u957f\u5ea6\u4e0d\u8d85\u8fc7 <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-4db9a69e2e77f2c21a15b91d0d5c7c20_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;&#43;&#49;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"65\" style=\"vertical-align: -2px;\"\/> \u7684\u56fe\u4e0a\u8def\u5f84\uff0c\u7136\u540e\u518d\u8981\u6c42\u5b9e\u73b0\u8fd9\u4e2a\u53d8\u6362\u7684\u9006\u53d8\u6362\u3002<\/p>\n\n\n\n<p>\u5efa\u8bae\u81ea\u5df1\u60f3\u4e00\u60f3\uff0c\u8fd8\u662f\u633a\u6709\u610f\u601d\u7684\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5927\u6982\u6240\u6709\u9009\u624b\u90fd\u4f1a\u4e00\u5f00\u59cb\u53bb\u7b97\u4e00\u7b97\u4ece\u6bcf\u4e2a\u70b9\u51fa\u53d1\u7684\u957f\u5ea6\u4e3an\u7684\u8def\u5f84\u5171\u6709\u591a\u5c11\u4e2a\u2026\u2026\u8bbe\u8fd9\u4e2a\u56fe\u4e3aG\uff0cG\u7684\u90bb\u63a5\u77e9\u9635\u4e3aA\uff08\u672a\u5217\u51fa\u4e3a0\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><p class=\"ql-center-displayed-equation\" style=\"line-height: 251px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-b1a1ff55cb8e38f30229ed0a40942ce4_l3.png\" height=\"251\" width=\"345\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#65;&#61; &#32;&#32;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#92;&#92; &#32;&#32;&#32;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#32;&#38;&#32;&#49;&#32;&#38;&#32;&#32;&#92;&#92; &#32;&#32;&#92;&#101;&#110;&#100;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/code><\/pre>\n\n\n\n<p>\u90a3\u4e48\u957f\u5ea6\u4e3an+1\u7684\u5e8f\u5217\u4e2a\u6570\u5c31\u662f<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-115eb80730f6f1c7247b35e42552c2da_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#65;&#94;&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"28\" style=\"vertical-align: 0px;\"\/>\u4e2d\u6240\u6709\u6570\u5b57\u7684\u548c\u3002\u4e3a\u4e86\u5145\u5206\u4e86\u89e3\u589e\u957f\u7684\u8d8b\u52bf\uff0c\u53ef\u4ee5\u4f7f\u7528WolframAlpha\u4f5c\u4e3a\u5de5\u5177\u6c42\u51fa\u6240\u6709\u7279\u5f81\u503c\uff0c\u53d1\u73b0\u6700\u5927\u7684\u7279\u5f81\u503c\u4e3a2\uff0c\u5bf9\u5e94\u7684\u7279\u5f81\u5411\u91cf\u4e3a<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-ebf58bcf7b85ac5ee1157d28992dfd6a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#86;&#101;&#99;&#61;&#32;&#40;&#51;&#44;&#32;&#54;&#44;&#32;&#52;&#44;&#32;&#50;&#44;&#32;&#53;&#44;&#32;&#52;&#44;&#32;&#51;&#44;&#32;&#50;&#44;&#32;&#49;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"23\" width=\"273\" style=\"vertical-align: -6px;\"\/>\uff0c\u8fd9\u6837\u4e00\u6765\u5c31\u77e5\u9053\u8def\u5f84\u6570\u76ee\u7684\u589e\u957f\u8d8b\u52bf\u4e5f\u662f <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-06963039bdb3c765d4e886e2905db3e1_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#50;&#94;&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"22\" style=\"vertical-align: 0px;\"\/> \uff0c\u540c\u6240\u8981\u6c42\u7684\u957f\u5ea6\u6ca1\u6709\u6e10\u8fdb\u6027\u7684\u5dee\u8ddd\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u5e94\u5f53\u5982\u4f55\u505a\u5462\uff1f\u6211\u4eec\u4ece\u7279\u5f81\u5411\u91cf\u4e0a\u8fdb\u884c\u8003\u8651\u3002\u5bf9\u4e8e<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nocriz.com\/wp-content\/ql-cache\/quicklatex.com-10ba8ad469564a9d5f09fdff6d6c117e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#51;&#44;&#32;&#54;&#44;&#32;&#52;&#44;&#32;&#50;&#44;&#32;&#53;&#44;&#32;&#52;&#44;&#32;&#51;&#44;&#32;&#50;&#44;&#32;&#49;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"23\" width=\"201\" style=\"vertical-align: -6px;\"\/>\uff0c\u7531\u4e8e\u8fd9\u662f\u7279\u5f81\u503c2\u5bf9\u5e94\u7684\u7279\u5f81\u5411\u91cf\uff0c\u4f7f\u7528\u77e9\u9635\u8fdb\u884c\u4e00\u6b21\u4e58\u79ef\u4e4b\u540e\u5f97\u5230\u7684\u5c31\u662f\u539f\u5411\u91cf*2\u3002\u8003\u8651\u77e9\u9635\u4e58\u6cd5\u7684\u8fc7\u7a0b\uff0c\u5c31\u548c\u8fd9\u4e2a\u4f2a\u4ee3\u7801\u8f6c\u79fb\u662f\u4e00\u6837\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C  = &#91;3, 6, 4, 2, 5, 4, 3, 2, 1]\nC' = &#91;0, 0, 0, 0, 0, 0, 0, 0, 0]\nfor i in V:\n    for j in G&#91;i]:\n        C'&#91;j]+=C&#91;i]<\/code><\/pre>\n\n\n\n<p>\u8fd9\u5c31\u542f\u53d1\u6211\u4eec\u53ef\u4ee5\u5efa\u7acb\u5982\u4e0b\u7684\u4e00\u4e2a\u65b0\u7684\u56feG2\uff1a<\/p>\n\n\n\n<p>G2\u4e2d\u7684\u6bcf\u4e00\u4e2a\u70b9\u4e3a\u4e00\u4e2a\u6570\u5bf9(i,j)\uff0c\u5176\u4e2di\u4e3aG\u4e2d\u7684\u4e00\u4e2a\u70b9\uff0cj\u4e3a[0,Vec[i)\u4e2d\u7684\u4e00\u4e2a\u6574\u6570\u3002<\/p>\n\n\n\n<p>\u540c\u65f6\u6211\u4eec\u53ef\u4ee5\u8fde\u8fb9\uff0c\u5bf9\u4e8e\u6bcf\u4e00\u4e2aG\u4e2d\u7684\u70b9\u5bf9(u,v)\uff0c\u5982\u679c\u8fd9\u4e24\u4e2a\u70b9\u4e4b\u95f4\u662f\u6709\u8fb9\u7684\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u628aG2\u4e2d\u6bcf\u4e00\u4e2a(u,x)\u8fde\u5411\u67d0\u4e00\u4e2a(v,y)\uff0c\u540c\u65f6\u786e\u4fdd\u6bcf\u4e00\u4e2aG2\u4e2d\u7684\u70b9\u5165\u5ea6\u4e0d\u8d85\u8fc72\u3002\u7531\u4e8e\u7279\u5f81\u5411\u91cf\u7684\u6027\u8d28\uff0cG2\u4e2d\u6bcf\u4e00\u4e2a\u70b9\u7684\u5165\u5ea6\u5c06\u4f1a\u6070\u597d\u4e3a2\uff01<\/p>\n\n\n\n<p>\u5b9e\u73b0\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void build_graph(){\n    for(int i=1;i&lt;=9;i++){\n        for(auto ct:G&#91;i]){\n            for(int j=0;j&lt;vec&#91;i];j++){\n                for(int k=0;k&lt;vec&#91;ct];k++)\n                if(fr&#91;ct]&#91;k].size()&lt;2){\n                    G2&#91;i]&#91;j].PB(MP(MP(ct,k),fr&#91;ct]&#91;k].size()));\n                    fr&#91;ct]&#91;k].PB(MP(i,j));\n                    break;\n                }\n            }\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u65f6\u5c31\u81ea\u7136\u7684\u60f3\u5230\uff0c\u4e00\u4e2a\u70b9\u7684\u5165\u5ea6\u4e3a2\uff0c\u90a3\u4e48\u6211\u4eec\u5c06G2\u4e2d\u6240\u6709\u8fb9\u53cd\u5411\uff0c\u5f97\u5230\u4e00\u4e2a\u53cd\u56feG2&#8217;\u3002\u6bcf\u4e2a\u70b9\u7684\u51fa\u8fb9\u6070\u597d\u4e24\u6761\uff0c\u7f16\u53f7\u4e3a0\u548c1\u540e\uff0c\u6211\u4eec\u4eceG2&#8217;\u7684(1,0)\u70b9\u51fa\u53d1\uff0c\u6bcf\u6b21\u6309\u716701\u5e8f\u5217\u5bf9\u5e94\u7684\u8fb9\u8d70\uff0c\u4e0d\u5c31\u552f\u4e00\u7684\u5f97\u5230\u4e00\u4e2a\u957f\u5ea6\u4e3an+1\u7b80\u5355\u8def\u5f84\u4e86\uff1f<\/p>\n\n\n\n<p>\u8fd9\u79cd\u65b9\u6cd5\u7684\u95ee\u9898\u5728\u4e8e\uff0c\u6709\u65f6\u50190\u8fb9\u548c1\u8fb9\u6307\u5411\u7684\u70b9\u5728G\u4e2d\u7684\u7f16\u53f7\u662f\u76f8\u540c\u7684\u3002\u6bd4\u5982(1,0)\u7684\u4e24\u4e2a\u51fa\u8fb9\u5c31\u53ef\u80fd\u662f(2,0)\u548c(2,1)\uff0c\u56e0\u4e3a1\u5728G\u7684\u5ea6\u6570\u662f1\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u5728G2\u4e2d\uff0c\u5bf9\u4e8e\u6240\u6709G\u4e2d\u76f8\u90bb\u7684\u70b9(u,v)\uff0c\u6bcf\u4e2a\u70b9(u,x)\u6709\u4e14\u53ea\u6709\u4e00\u6761\u8fb9\u8fde\u5411\u67d0\u4e00\u4e2a\u4ee5v\u4e3a\u7b2c\u4e00\u7ef4\u5750\u6807\u7684\u8282\u70b9(v,?)\u3002\u56e0\u6b64\u5982\u679c\u6211\u4eec\u77e5\u9053\u4e0a\u4e00\u4e2a\u8fc7\u7a0b\u4e2d\u8d70\u5230\u7684\u6700\u540e\u4e00\u4e2a\u8282\u70b9\u7684\u7b2c\u4e8c\u7ef4\u5ea6\u7684\u5750\u6807\uff0c\u5c31\u53ef\u4ee5\u552f\u4e00\u5730\u4ee5\u76f8\u53cd\u7684\u987a\u5e8f\u63a8\u51fa\u6240\u7f16\u780101\u5e8f\u5217\u4e86\u3002\u4e3a\u4e86\u5c06\u8fd9\u4e2a\u4fe1\u606f\uff08\u7b2c\u4e8c\u7ef4\u5ea6\u7684\u5750\u6807\uff09\u7f16\u7801\uff0c\u6211\u4eec\u9700\u8981\u5728\u8def\u5f84\u7684\u5f00\u59cb\uff0c\u8282\u70b91\u4e4b\u524d\u52a0\u4e0a\u4e00\u4e2a\u76f8\u5e94\u957f\u5ea6\u7684\u8def\u5f84\u5982(1-2-5-6-7-8)\u3002<\/p>\n\n\n\n<p>\u8fd9\u6837\uff0c\u7531\u4e8e\u6240\u6709\u7b2c\u4e8c\u7ef4\u5ea6\u7684\u5750\u6807\u4e0d\u8d85\u8fc76\uff0c\u6700\u7ec8\u7b54\u6848\u7684\u957f\u5ea6\u4e00\u5b9a\u662f\u5728n+10\u4e4b\u5185\u7684\u3002<\/p>\n\n\n\n<p>\u4e0b\u9644\u4ee3\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;bits\/stdc++.h>\nusing namespace std;\ntypedef long long ll;\ntypedef pair&lt;int,int> pii;\n#define set0(x) memset(x,0,sizeof(x))\n#define F first\n#define S second\n#define PB push_back\n#define MP make_pair\n#define rep(i, a, b) for(int i = a; i &lt; (b); ++i)\n#define trav(a, x) for(auto&amp; a : x)\n#define all(x) x.begin(), x.end()\n#define sz(x) (int)(x).size()\nvector&lt;int> G&#91;10];\nvector&lt; pair&lt;pii,int> > G2&#91;10]&#91;10];\nvector&lt; pii > fr&#91;10]&#91;10];\n\nint vec&#91;11] = {0,3,6,4,2,5,4,3,2,1,0};\nvoid ins(int a,int b){\n    G&#91;a].push_back(b);\n    G&#91;b].push_back(a);\n}\n\nvoid build_graph(){\n    for(int i=1;i&lt;=9;i++){\n        for(auto ct:G&#91;i]){\n            for(int j=0;j&lt;vec&#91;i];j++){\n                for(int k=0;k&lt;vec&#91;ct];k++)\n                if(fr&#91;ct]&#91;k].size()&lt;2){\n                    G2&#91;i]&#91;j].PB(MP(MP(ct,k),fr&#91;ct]&#91;k].size()));\n                    fr&#91;ct]&#91;k].PB(MP(i,j));\n                    break;\n                }\n            }\n        }\n    }\n}\n\nvoid solve1(){\n    int n;string s;\n    cin>>n>>s;\n    pii pos(1,0);\n    string ans;\n    for(int i=0;i&lt;s.size();i++){\n        ans+=(char)('0'+pos.F);\n        pos = fr&#91;pos.F]&#91;pos.S]&#91;s&#91;i]-'A'];\n    }\n    ans+=(char)('0'+pos.F);\n    reverse(all(ans));\n    ans+=((string)\"25678\").substr(0,pos.S);\n    cout&lt;&lt;ans&lt;&lt;endl;\n}\n\nvoid solve2(){\n    int n;string s;\n    cin>>n>>s;\n    pii pos(s&#91;0]-'0',(map&lt;char,int>{{'1',0},{'2',1},{'5',2},{'6',3},{'7',4},{'8',5}}&#91;s&#91;s.size()-1]]));\n    while(s&#91;s.size()-1]!='1')s = s.substr(0,s.size()-1);\n    string ans;\n    for(int i=1;i&lt;s.size();i++){\n        for(auto ct:G2&#91;pos.F]&#91;pos.S]){\n            if(ct.F.F == s&#91;i]-'0'){\n                ans+=ct.S+'A';\n                pos = ct.F;\n                break;\n            }\n        }\n    }\n    reverse(all(ans));\n    cout&lt;&lt;ans&lt;&lt;endl;\n}\nstring s;\nint main() {\n    ins(1,2);ins(2,3);ins(2,5);ins(3,4);\n    ins(5,6);ins(6,7);ins(7,8);ins(8,9);\n    cin>>s;\n    build_graph();\n    if(s == \"first\"){\n        solve1();\n    }else{\n        solve2();\n    }\n    return 0;\n}<\/code><\/pre>\n ","protected":false},"excerpt":{"rendered":"<p>\u524d\u51e0\u5929\u592a\u9e3d\u4e86\uff0c\u6ca1\u600e\u4e48\u8001\u8001\u5b9e\u5b9e\u641e\u7ade\u8d5bQwQ\u2026\u2026Deadline\u5c06\u8fd1\uff0c\u6211\u53ea\u597d\u6765\u5206\u4eab\u4e00\u9053\u9898\u3002\u6211\u7684\u6570\u5b66\u6c34\u5e73\u5c1a\u4e14\u975e\u5e38\u6709\u9650 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/nocriz.com\/index.php?rest_route=\/wp\/v2\/posts\/435"}],"collection":[{"href":"https:\/\/nocriz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nocriz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nocriz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nocriz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435"}],"version-history":[{"count":11,"href":"https:\/\/nocriz.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/nocriz.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/nocriz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nocriz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nocriz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}