{"id":539,"date":"2018-12-30T13:35:17","date_gmt":"2018-12-30T05:35:17","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=539"},"modified":"2018-12-30T13:35:17","modified_gmt":"2018-12-30T05:35:17","slug":"lp3355-%e7%bd%91%e7%bb%9c%e6%b5%8124%e9%a2%98-%e9%aa%91%e5%a3%ab%e5%85%b1%e5%ad%98%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2018\/12\/30\/lp3355-%e7%bd%91%e7%bb%9c%e6%b5%8124%e9%a2%98-%e9%aa%91%e5%a3%ab%e5%85%b1%e5%ad%98%e9%97%ae%e9%a2%98\/","title":{"rendered":"lp3355 \u7f51\u7edc\u6d4124\u9898-\u9a91\u58eb\u5171\u5b58\u95ee\u9898"},"content":{"rendered":"\n<p>\u9996\u5148\u6211\u4eec\u89c2\u5bdf\u8fd9\u9053\u9898\u3002<br>\n\u66b4\u529b\u5730\u72b6\u538bDP\u6216\u8005\u4e4b\u7c7b\u7684\u64cd\u4f5c\u663e\u7136\u4f1aMLE\/TLE\u3002<br>\n\u6211\u4eec\u53d1\u73b0\uff0c\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\u76f8\u52a0\u7684\u548c\u7684\u5947\u5076\u6027\u76f8\u540c\u7684\u683c\u5b50\u6c38\u8fdc\u4e0d\u53ef\u80fd\u4e92\u76f8\u653b\u51fb\u5230\u3002<br>\n\u6545\u800c\u6211\u4eec\u8003\u8651\u5efa\u4e00\u5f20\u4e8c\u5206\u56fe\u3002\u5c06\u6a2a\u7eb5\u5750\u6807\u7684\u548c\u7684\u5947\u5076\u6027\u4e0d\u540c\u7684\u683c\u5b50\u5206\u522b\u653e\u5728\u5de6\u53f3\u8fb9\uff0c\u7136\u540e\u5728\u80fd\u76f8\u4e92\u653b\u51fb\u5230\u7684\u70b9\u4e4b\u95f4\u8fde\u8fb9\u3002\u4f9d\u636e\u9898\u610f\uff0c\u4e0d\u80fd\u76f8\u4e92\u653b\u51fb\u5230\uff0c\u6240\u4ee5\u7b54\u6848\u5373\u662f\u8fd9\u5f20\u56fe\u7684\u6700\u5927\u72ec\u7acb\u96c6\u3002<\/p>\n\n\n\n<p>\u4e8c\u5206\u56fe\u6700\u5927\u72ec\u7acb\u96c6\u5e94\u5f53\u5982\u4f55\u6c42\u5f97\uff1f\u6211\u4eec\u6709\u4e00\u4e2a\u5b9a\u7406\uff1a\u4e00\u5f20\u4e8c\u5206\u56fe\u7684\u6700\u5927\u72ec\u7acb\u96c6\u7684\u5927\u5c0f\u7b49\u540c\u4e8e\u9876\u70b9\u6570\u5b83\u7684\u6700\u5927\u5339\u914d\u7684\u6570\u91cf\u3002<br>\n\u6211\u4eec\u8003\u8651\u611f\u6027\u5730\u8bc1\u660e\u8fd9\u4e2a\u5b9a\u7406\u3002 <br>\n\u5f88\u5bb9\u6613\u53ef\u4ee5\u53d1\u73b0\uff0c\u4e24\u4e2a\u70b9\u4e0d\u80fd\u88ab\u540c\u65f6\u9009\u53d6\uff0c\u5f53\u4e14\u4ec5\u5f53\u5b83\u4eec\u4e4b\u95f4\u6709\u8fde\u8fb9\u3002<br>\n\u53c8\u56e0\u4e3a\uff0c\u6709\u8fde\u8fb9\u7684\u4e24\u4e2a\u70b9\u5fc5\u7136\u662f\u5c5e\u4e8e\u4e8c\u5206\u56fe\u7684\u4e24\u7aef\u7684\u3002<br>\n\u6545\u800c\uff0c\u5982\u679c\u6709\u4e24\u4e2a\u70b9\u4e0d\u80fd\u88ab\u540c\u65f6\u9009\u53d6\uff0c\u5b83\u4eec\u5fc5\u7136\u53ef\u4ee5\u6784\u6210\u4e00\u4e2a\u5339\u914d\u3002<br>\n\u5bf9\u4e8e\u4e8c\u5206\u56fe\u4e0a\u7684\u6700\u5927\u5339\u914d\uff0c\u6240\u6709\u6ca1\u6709\u88ab\u5339\u914d\u7684\u70b9\u90fd\u53ef\u4ee5\u88ab\u9009\u53d6\u3002\u8fd9\u975e\u5e38\u7684\u663e\u7136\uff0c\u56e0\u4e3a\u6ca1\u6709\u88ab\u5339\u914d\u5230\u7684\u70b9\u4e4b\u95f4\u5fc5\u7136\u6ca1\u6709\u8fde\u8fb9\u3002\u5982\u679c\u6709\u8fde\u8fb9\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u589e\u52a0\u5339\u914d\uff0c\u4e0e\u6700\u5927\u5339\u914d\u77db\u76fe\u3002<br>\n\u800c\uff0c\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u5339\u914d\uff0c\u90fd\u53ef\u4ee5\u9009\u53d6\u4e00\u7ec4\u5339\u914d\u4e2d\u7684\u4e00\u4e2a\u70b9\u3002\u8fd9\u662f\u56e0\u4e3a\uff0c\u5bf9\u4e8e\u4e00\u4e9b\u8fde\u901a\u7684\u5339\u914d\uff0c\u5b83\u4eec\u6709\u4e14\u4ec5\u6709\u4e00\u4e2a\u90e8\u5206\uff08\u5de6\u8fb9\u6216\u8005\u53f3\u8fb9\uff09\u4f1a\u548c\u672a\u5339\u914d\u70b9\u8fde\u63a5\u3002<br>\n\u8fd9\u4e5f\u662f\u5f88\u663e\u7136\u7684\uff0c\u56e0\u4e3a\u5982\u679c\u4e0d\u662f\u8fd9\u6837\u7684\u8bdd\uff0c\u5c31\u5b58\u5728\u4e00\u6761\u65b0\u7684\u589e\u5e7f\u8def\u5f84\uff0c\u5c31\u53ef\u4ee5\u5f97\u5230\u66f4\u591a\u7684\u5339\u914d\u4e86\u3002<br>\n\u6ce8\u610f\uff1a\u5750\u6807\u5982\u4f55\u54c8\u5e0c\u6210\u4e00\u4e2a\u6570\u5b57\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n\nconst int dx[8]={-2,-1,1,2,-2,-1,1,2};\nconst int dy[8]={1,2,2,1,-1,-2,-2,-1}; \n\nstruct ee{\n\tint v;\n\tint nxt;\n}e[160005];\nint h[40005],et=0;\n\ninline void add(int U,int V){\n\te[++et]=(ee){V,h[U]};\n\th[U]=et; \n}\n\nbool vis[40005],mp[205][205];\nint n=0,m=0,usd[40005];\n\ninline int calc(int X,int Y){\n\treturn (X-1)*n+Y;\n\/\/\t\u6ce8\u610f\u5750\u6807\u54c8\u5e0c\u6210\u6570\u5b57\u7684\u65b9\u5f0f\u3002 \n}\n\ninline bool dfs(int X){\n\tfor(int i=h[X];i;i=e[i].nxt){\n\t\tif(!vis[e[i].v]){\n\t\t\tvis[e[i].v]=1;\n\t\t\tif(!usd[e[i].v]||dfs(usd[e[i].v])){\n\t\t\t\tusd[e[i].v]=X;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint st[40005],tp=0;\nchar out[205][205];\nvoid init(){\n\tscanf(\"%d%d\",&amp;n,&amp;m);\n\tfor(int i=1;i&lt;=n;++i){\n\t\tfor(int j=1;j&lt;=n;++j){\n\t\t\tmp[i][j]=0;\n\t\t\tusd[calc(i,j)]=0;\n\t\t\tout[i][j]='O';\n\t\t}\n\t}\n\tint x,y;\n\tfor(int i=1;i&lt;=m;++i){\n\t\tscanf(\"%d%d\",&amp;x,&amp;y);\n\t\tmp[x][y]=1;\n\t}\n\tfor(int i=1;i&lt;=n;++i){\n\t\tfor(int j=1;j&lt;=n;++j){\n\/\/\t\t\tprintf(\"[%d %d] \",i,j);\n\t\t\tif(mp[i][j]||((i+j)&amp;1)){\n\/\/\t\t\t\t\u6ce8\u610f\u4e0d\u662f\u6bcf\u6b21\u8df32\u800c\u662f\u5224\u5947\u5076\u6027\u3002 \n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tst[++tp]=calc(i,j);\n\t\t\tout[i][j]='@'; \n\t\t\t\/\/\u6ce8\u610f\u6709\u969c\u788d\u7684\u4e0d\u4ec5\u662f\u7ed3\u675f\u70b9\uff0c\u8fd8\u6709\u51fa\u53d1\u70b9\u3002 \n\t\t\tfor(int k=0;k&lt;8;++k){\n\t\t\t\tx=i+dx[k],y=j+dy[k];\n\t\t\t\tif(x&lt;=0||y&lt;=0||x>n||y>n||mp[x][y]){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tout[x][y]='X';\n\t\t\t\tadd(calc(i,j),calc(x,y));\n\t\t\t}\n\t\t}\n\t}\n\/\/\tfor(int i=1;i&lt;=n;++i){\n\/\/\t\tfor(int j=1;j&lt;=n;++j){\n\/\/\t\t\tputchar(out[i][j]);\n\/\/\t\t}\n\/\/\t\tputs(\"\");\n\/\/\t}\n\tint ans=n*n-m;\n\/\/\t\u51cf\u53bb\u88ab\u6316\u6389\u7684\u70b9 \n\tfor(int i=1;i&lt;=tp;++i){\n\t\tfor(int j=1;j&lt;=n*n;++j){\n\t\t\tvis[j]=0;\n\t\t}\n\t\tans-=dfs(st[i]);\n\t}\n\tprintf(\"%d\\n\",ans);\n}\n\nint main(){\n\tinit();\n\treturn 0;\n} <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u6211\u4eec\u89c2\u5bdf\u8fd9\u9053\u9898\u3002 \u66b4\u529b\u5730\u72b6\u538bDP\u6216\u8005\u4e4b\u7c7b\u7684\u64cd\u4f5c\u663e\u7136\u4f1aMLE\/TLE\u3002 \u6211\u4eec\u53d1\u73b0\uff0c\u6a2a\u5750\u6807\u548c\u7eb5\u5750\u6807\u76f8\u52a0\u7684\u548c\u7684\u5947 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2018\/12\/30\/lp3355-%e7%bd%91%e7%bb%9c%e6%b5%8124%e9%a2%98-%e9%aa%91%e5%a3%ab%e5%85%b1%e5%ad%98%e9%97%ae%e9%a2%98\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201clp3355 \u7f51\u7edc\u6d4124\u9898-\u9a91\u58eb\u5171\u5b58\u95ee\u9898\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[65,67,30,76,6,75,78,5],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/539"}],"collection":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/comments?post=539"}],"version-history":[{"count":1,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/539\/revisions"}],"predecessor-version":[{"id":540,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/539\/revisions\/540"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=539"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}