{"id":694,"date":"2019-03-05T20:04:39","date_gmt":"2019-03-05T12:04:39","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=694"},"modified":"2019-03-05T20:04:39","modified_gmt":"2019-03-05T12:04:39","slug":"lp4363-%e4%b9%9d%e7%9c%81%e8%81%94%e8%80%832018-%e4%b8%80%e5%8f%8c%e6%9c%a8%e6%a3%8bchess","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2019\/03\/05\/lp4363-%e4%b9%9d%e7%9c%81%e8%81%94%e8%80%832018-%e4%b8%80%e5%8f%8c%e6%9c%a8%e6%a3%8bchess\/","title":{"rendered":"lp4363 \u4e5d\u7701\u8054\u80032018 \u4e00\u53cc\u6728\u68cbchess"},"content":{"rendered":"\n<p>\u5feb\u8981\u7701\u9009\u4e86\uff0c\u9700\u8981\u5b66\u4e60\u4e00\u4e9b\u4e71\u641e\u64cd\u4f5c\u3002<br>\n\u5728\u8fd9\u91cc\u5b66\u4e60\u4e00\u4e0bMin-Max\u5bf9\u6297\u641c\u7d22\u3002<br>\n\u9996\u5148\u4e86\u89e3\u4e00\u4e0bMin-Max\u5bf9\u6297\u641c\u7d22\u3002<br>\n\u9996\u5148\u6211\u4eec\u77e5\u9053\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u96f6\u548c\u6709\u9650\u4fe1\u606f\u786e\u5b9a\u6027\u535a\u5f08\u6e38\u620f\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6574\u4e2a\u6e38\u620f\u7684\u6240\u6709\u5c40\u9762\u5efa\u6210\u4e00\u4e2a\u6709\u5411\u56fe\u3002\u800c\u5728\u51e0\u4e4e\u6240\u6709\u6b64\u7c7b\u6e38\u620f\u4e2d\uff0c\u6574\u4e2a\u6e38\u620f\u7684\u6240\u6709\u5c40\u9762\u5e94\u5f53\u80fd\u7ec4\u6210\u4e00\u4e2aDAG\u3002<br>\n\u5bf9\u4e8e\u8fd9\u6837\u4e00\u4e2aDAG\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u5b83\u8fdb\u884c\u5206\u5c42\uff0c\u6700\u540e\u5f97\u5230\u7684\u5e94\u5f53\u662f\u4e00\u5f20\u5206\u5c42\u56fe\u3002\u8fd9\u5f20\u5206\u5c42\u56fe\u4e0a\u7684\u6bcf\u4e00\u5c42\u8c61\u5f81\u7740\u4e00\u65b9\u6b63\u5728\u8fdb\u884c\u64cd\u4f5c\u3002<br>\n\u90a3\u4e48\u663e\u7136\u8fd9\u4e2a\u6e38\u620f\u7684\u6700\u7ec8\u89e3\u662f\u53ef\u4ee5\u77e5\u9053\u7684\u3002\u65e0\u975e\u5c31\u662f\u76f4\u63a5\u628a\u6574\u5f20\u56feDFS\u4e00\u904d\u7f62\u4e86\u3002<br>\n\u7136\u800c\uff0c\u5728\u7edd\u5927\u90e8\u5206\u6e38\u620f\u4e2d\uff0c\u8fd9\u4e48\u505a\u7684\u590d\u6742\u5ea6\u90fd\u592a\u5927\u4e86\uff0c\u4ee5\u81f3\u4e8e\u6839\u672c\u65e0\u6cd5\u63a5\u53d7\u3002\u6211\u4eec\u8003\u8651\u4e00\u79cd\u88ab\u79f0\u4e3aMin-Max\u5bf9\u6297\u641c\u7d22\u7684\u641c\u7d22\u65b9\u6cd5\u3002<br>\n\u6211\u4eec\u9996\u5148\u5b9a\u4e49\u5148\u624b\u65b9\u4e3aMax\u65b9\uff0c\u540e\u624b\u65b9\u4e3aMin\u65b9\uff0c\u7136\u540e\u8bbe\u7f6e\u4e00\u4e2a\u641c\u7d22\u8303\u56f4\u3002\u90a3\u4e48\u6bcf\u4e00\u4e2a\u8282\u70b9\u7684\u503c\u662f\u8fd9\u6837\u786e\u5b9a\u7684\uff1a<br>\n\u5982\u679c\u5b83\u7684\u6df1\u5ea6\u662f\u641c\u7d22\u6df1\u5ea6\u8fb9\u7f18\uff0c\u4ea6\u6216\u8005\u5b83\u5e72\u8106\u5c31\u662f\u4e00\u4e2a\u7ec8\u6b62\u5c40\u9762\uff0c\u90a3\u4e48\u5b83\u7684\u503c\u5c31\u662f\u4e00\u4e2a\u7cbe\u5fc3\u8bbe\u8ba1\u7684\u4f30\u4ef7\u51fd\u6570\u7684\u503c\u3002\u8fd9\u4e2a\u4f30\u4ef7\u51fd\u6570\u5e94\u5f53\u80fd\u591f\u8f83\u597d\u5730\u4f30\u8ba1\u6574\u4e2a\u5c40\u9762\u503e\u5411\u4e8e\u54ea\u4e00\u65b9\u3002 <br>\n\u5982\u679c\u8fd9\u4e2a\u8282\u70b9\u662f\u7531Max\u65b9\u884c\u52a8\uff0c\u90a3\u4e48\u5b83\u7684\u503c\u662f\u6240\u6709\u5b50\u5c40\u9762\u91cc\u7684\u503c\u7684\u6700\u5927\u503c\uff0c\u56e0\u4e3aMax\u65b9\u4f1a\u5411\u5bf9\u81ea\u5df1\u6700\u6709\u5229\u7684\u5c40\u9762\u8d70\u3002<br>\n\u5982\u679c\u8fd9\u4e2a\u8282\u70b9\u662f\u7531Min\u65b9\u884c\u52a8\uff0c\u90a3\u4e48\u5b83\u7684\u503c\u662f\u6240\u6709\u5b50\u5c40\u9762\u91cc\u7684\u503c\u7684\u6700\u5c0f\u503c\uff0c\u56e0\u4e3aMin\u65b9\u4f1a\u5411\u5bf9Max\u65b9\u6700\u4e0d\u5229\u7684\u5c40\u9762\uff0c\u4e5f\u5c31\u662f\u5bf9\u81ea\u5df1\u6700\u6709\u5229\u7684\u5c40\u9762\u8d70\u3002<br>\n\u8fd9\u6837\u5c31\u80fd\u591f\u6c42\u5f97\u5f53\u524d\u5c40\u9762\u7684\u6743\u503c\uff0c\u4ece\u800c\u5f97\u5230\u4e00\u4e2a\u8f83\u4f18\u79c0\u7684\u51b3\u7b56\u652f\u4e86\u3002<br>\n\u672c\u6765\u6253\u7b97\u5b66\u4e00\u4e0balpha-beta\u526a\u679d\u7684\uff0c\u4f46\u662f\u8fd9\u4e00\u9898\u597d\u50cf\u4e0d\u662f\u5f88\u9700\u8981\u2026 <\/p>\n\n\n\n<p>\u56de\u5230\u8fd9\u4e00\u9898\uff0c\u5982\u679c\u6211\u4eec\u66b4\u529b\u50a8\u5b58\u6bcf\u4e00\u4e2a\u72b6\u6001\uff0c\u90a3\u4e48\u5f88\u663e\u7136\u65f6\u95f4\u4f1a\u7206\u70b8\u3002\u6709\u6ca1\u6709\u66f4\u597d\u7684\u601d\u8def\u5462\uff1f<br>\n\u76f4\u89c9\u544a\u8bc9\u6211\u4eec\uff0c\u4e00\u4e2a\u683c\u5b50\u653e\u7f6e\u7684\u6b21\u5e8f\u548c\u7b54\u6848\u662f\u6ca1\u6709\u5173\u7cfb\u7684\u3002\u6240\u4ee5\u6211\u4eec\u4e0d\u59a8\u5047\u5b9a\u5f53\u524d\u653e\u7f6e\u7684\u683c\u5b50\u603b\u662f\u5de6\u4e0a\u89d2\u7684\u4e00\u6574\u4e2a\u5757\u3002\u8fd9\u6837\u72b6\u6001\u6570\u5927\u6982\u5c31\u572810^10\u4ee5\u5185\u4e86\u3002<br>\n\u7136\u800c\u5b9e\u9645\u4e0a\u5e76\u4e0d\u9700\u8981\u8fd9\u4e48\u591a\u7684\u72b6\u6001\u3002\u6240\u4ee5\u53ef\u4ee5Hash\u4ee5\u540e\u7528map\u79bb\u6563\u5316\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;tr1\/unordered_map>\n\ninline int Max(int A,int B){\n\treturn A>B?A:B;\n}\n\ninline int Min(int A,int B){\n\treturn A&lt;B?A:B;\n}\nconst int INF=0x3f3f3f3f;\nstd::tr1::unordered_map&lt;long long,int> mp;\nint a[11][11],b[11][11],f[11],n,m;\n\ninline long long hsh(){\n\tlong long RT=0;\n\tfor(int i=1;i&lt;=n;++i){\n\t\tRT*=12;\n\t\tRT+=f[i];\n\t}\n\treturn RT;\n}\n\ninline void ahsh(long long X){\n\tfor(int i=n;i>=1;--i){\n\t\tf[i]=X%12;\n\t\tX\/=12;\n\t}\n}\n\ninline int dfs(long long X,bool typ){\n\tif(mp.count(X)){\n\t\treturn mp[X];\n\t}\n\tint RT=typ?-INF:INF;\n\tlong long nw;\n\tahsh(X);\n\tfor(int i=1;i&lt;=n;++i){\n\t\tif(f[i]&lt;f[i-1]){\n\t\t\t++f[i];nw=hsh();\n\t\t\tRT=typ?Max(RT,dfs(nw,0)+a[i][f[i]]):Min(RT,dfs(nw,1)-b[i][f[i]]);\n\t\t\t--f[i];\n\t\t}\n\t}\n\treturn mp[X]=RT;\n}\n\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;=m;++j){\n\t\t\tscanf(\"%d\",&amp;a[i][j]);\n\t\t}\n\t}\n\tfor(int i=1;i&lt;=n;++i){\n\t\tfor(int j=1;j&lt;=m;++j){\n\t\t\tscanf(\"%d\",&amp;b[i][j]);\n\t\t}\n\t}\n\tfor(int i=0;i&lt;=n;++i){\n\t\tf[i]=m;\n\t}\n\tmp[hsh()]=0;\n\tprintf(\"%d\\n\",dfs(0,1));\n}\n\nint main(){\n\tinit();\n\treturn 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5feb\u8981\u7701\u9009\u4e86\uff0c\u9700\u8981\u5b66\u4e60\u4e00\u4e9b\u4e71\u641e\u64cd\u4f5c\u3002 \u5728\u8fd9\u91cc\u5b66\u4e60\u4e00\u4e0bMin-Max\u5bf9\u6297\u641c\u7d22\u3002 \u9996\u5148\u4e86\u89e3\u4e00\u4e0bMin-Max\u5bf9\u6297\u641c\u7d22 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2019\/03\/05\/lp4363-%e4%b9%9d%e7%9c%81%e8%81%94%e8%80%832018-%e4%b8%80%e5%8f%8c%e6%9c%a8%e6%a3%8bchess\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201clp4363 \u4e5d\u7701\u8054\u80032018 \u4e00\u53cc\u6728\u68cbchess\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":[99,26,30,24,53,9,6,5],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/694"}],"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=694"}],"version-history":[{"count":1,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/694\/revisions"}],"predecessor-version":[{"id":695,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/694\/revisions\/695"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=694"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}