{"id":575,"date":"2019-01-30T08:48:19","date_gmt":"2019-01-30T00:48:19","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=575"},"modified":"2019-01-30T08:48:19","modified_gmt":"2019-01-30T00:48:19","slug":"lp2805-noi2009-%e6%a4%8d%e7%89%a9%e5%a4%a7%e6%88%98%e5%83%b5%e5%b0%b8","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2019\/01\/30\/lp2805-noi2009-%e6%a4%8d%e7%89%a9%e5%a4%a7%e6%88%98%e5%83%b5%e5%b0%b8\/","title":{"rendered":"lp2805 NOI2009 \u690d\u7269\u5927\u6218\u50f5\u5c38"},"content":{"rendered":"\n<p>\u4ed4\u7ec6\u9605\u8bfb\u9898\u610f\uff0c\u6211\u4eec\u53d1\u73b0\uff0c\u8fd9\u9053\u9898\u672c\u8d28\u4e0a\u5c31\u662f\u4e00\u4e2a\u7ea6\u675f\u7c7b\u95ee\u9898\uff1a\u5bf9\u4e8e\u6bcf\u4e00\u682a\u690d\u7269\uff0c\u90fd\u5b58\u5728\u4e00\u4e9b\u690d\u7269\uff0c\u9700\u8981\u6d88\u706d\u6389\u5b83\u4eec\u624d\u80fd\u6d88\u706d\u5b83\u3002<br>\n\u6545\u800c\uff0c\u5b83\u5c31\u53d8\u6210\u4e86\u4e00\u4e2a\u8fd9\u6837\u7684\u95ee\u9898\uff1a\u5b58\u5728\u4e00\u4e9b\u690d\u7269\uff0c\u5176\u4e2d\u7684\u4e00\u4e9b\u8981\u6d88\u706d\u4e86\u53e6\u5916\u4e00\u4e9b\u4e4b\u540e\u624d\u80fd\u6d88\u706d\uff0c\u95ee\u6536\u76ca\u6700\u5927\u5316\u7684\u65b9\u6cd5\u3002<br>\n\u5982\u679c\u6211\u4eec\u5bf9\u6bcf\u4e00\u68f5\u690d\u7269\u5efa\u70b9\uff0c\u7136\u540e\u4ece\u4e00\u68f5\u690d\u7269\u5411\u5b83\u7684\u7ea6\u675f\u690d\u7269\u8fde\u8fb9\uff0c\u90a3\u4e48\u95ee\u9898\u5c31\u8f6c\u5316\u4e3a\uff1a\u4e00\u5f20\u6709\u5411\u56fe\uff0c\u6bcf\u4e2a\u70b9\u90fd\u6709\u70b9\u6743\uff0c\u8bf7\u9009\u4e2d\u5176\u4e2d\u7684\u67d0\u4e9b\u70b9\uff0c\u4f7f\u5f97\u6bcf\u4e2a\u70b9\u7684\u540e\u7ee7\u90fd\u5728\u8fd9\u5f20\u56fe\u4e2d\u3002<br>\n\u8fd9\u662f\u4e00\u7c7b\u88ab\u79f0\u4e3a\u300c\u6700\u5927\u6743\u95ed\u5408\u5b50\u56fe\u95ee\u9898\u300d\u7684\u95ee\u9898\u3002\u8fd9\u79cd\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u662f\uff0c\u4ece\u6e90\u70b9\u5411\u6b63\u6743\u70b9\u8fde\u6743\u503c\u4e3a\u70b9\u6743\u7684\u8fb9\uff1b\u4ece\u8d1f\u6743\u70b9\u5411\u6c47\u70b9\u8fde\u6743\u503c\u4e3a\u70b9\u6743\u7684\u7edd\u5bf9\u503c\u7684\u8fb9\u3002\u539f\u56fe\u4e2d\u7684\u8fb9\u6d41\u91cf\u65e0\u7a77\u5927\u3002 <br>\n\u90a3\u4e48\uff0c\u7b54\u6848\u5c31\u662f\u603b\u6743\u503c\u51cf\u53bb\u6700\u5c0f\u5272\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u4e0b\u9762\u6211\u4eec\u6765\u8bc1\u660e\u8fd9\u79cd\u5efa\u6a21\u65b9\u5f0f\u7684\u5408\u6cd5\u6027\u548c\u6700\u4f18\u6027\u3002<br>\n\u6211\u4eec\u4ee4\u4ece\u6e90\u70b9\u8fde\u51fa\u7684\u8fb9\u88ab\u5272\u6389\u8868\u793a\u4e0d\u9009\u4e2d\u8fd9\u4e2a\u70b9\uff0c\u8fde\u5411\u6c47\u70b9\u7684\u8fb9\u88ab\u5272\u6389\u8868\u793a\u9009\u4e2d\u8fd9\u4e2a\u70b9\u3002<br>\n\u90a3\u4e48\uff0c\u6700\u7ec8\u7684\u7ed3\u679c\u5fc5\u7136\u662f\u4e00\u4e2a\u95ed\u5408\u5b50\u56fe\u3002<br>\n\u8fd9\u662f\u56e0\u4e3a\uff0c\u5bf9\u4e8e\u8fd9\u5f20\u56fe\u7684\u6700\u5c0f\u5272\uff0c\u5f53\u4f60\u9009\u4e2d\u4e00\u4e2a\u8282\u70b9\u4e4b\u540e\uff0c\u8fd9\u4e2a\u70b9\u7684\u6240\u6709\u540e\u7ee7\u8d1f\u6743\u8282\u70b9\u90fd\u4e00\u5b9a\u88ab\u5272\u6389\/\u9009\u4e2d\u4e86\uff08\u6839\u636e\u5272\u7684\u6027\u8d28\u663e\u7136\uff09\uff1b <br>\n\u8fd9\u4e2a\u70b9\u7684\u6240\u6709\u540e\u7ee7\u6b63\u6743\u8282\u70b9\u90fd\u4e00\u5b9a\u4e0d\u88ab\u5272\/\u9009\u4e2d\u4e86\uff08\u6839\u636e\u6700\u5c0f\u5272\u7684\u6027\u8d28\uff0c\u5272\u6389\u8fd9\u4e9b\u8fb9\u6ca1\u6709\u610f\u4e49\uff09\u3002<br>\n\u5e76\u4e14\uff0c\u4efb\u4f55\u4e00\u4e2a\u95ed\u5408\u5b50\u56fe\u7684\u9009\u6cd5\u90fd\u81f3\u5c11\u53ef\u4ee5\u5bf9\u5e94\u4e00\u4e2a\u5272\u6cd5\u3002<br>\n\u8fd9\u662f\u56e0\u4e3a\uff0c\u5bf9\u4e8e\u539f\u56fe\u4e2d\u7684\u67d0\u4e00\u79cd\u8fde\u63a5\u65b9\u6cd5\uff0c\u90fd\u53ef\u4ee5\u901a\u8fc7\u5272\u6389\u4e0d\u5728\u5176\u4e4b\u4e2d\u7684\u6240\u6709\u8d1f\u6743\u8fb9\u548c\u5728\u5176\u4e4b\u4e2d\u7684\u6240\u6709\u8d1f\u6743\u8fb9\u6765\u4f7f\u5176\u5bf9\u5e94\u3002 <br>\n\u540c\u65f6\uff0c\u6839\u636e\u6211\u4eec\u6b64\u524d\u7684\u5b9a\u4e49\uff0c\u6700\u5c0f\u5272\u7684\u503c\u610f\u5473\u7740\u6ca1\u9009\u4e2d\u7684\u6b63\u6743\u70b9\u7684\u503c\u4e0e\u9009\u4e2d\u7684\u8d1f\u6743\u70b9\u7684\u503c\u7684\u7edd\u5bf9\u503c\u7684\u548c\u3002\u6545\u800c\uff0c\u7b54\u6848\u4fbf\u662f\u6b63\u6743\u5e97\u7684\u503c\u7684\u548c\u51cf\u53bb\u6700\u5c0f\u5272\u7684\u503c\u3002<br>\n\u800c\u6700\u5c0f\u5272\u662f\u8981\u5c3d\u91cf\u5c0f\u7684\uff0c\u6545\u800c\u6700\u5c0f\u5272\u53ef\u4ee5\u5f97\u5230\u6700\u4f18\u7b54\u6848\u3002 <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>PS:<br>\n\u8fd9\u4e00\u9898\u5e94\u5f53\u8003\u8651\u6b7b\u9501\u60c5\u51b5\uff0c\u60f3\u8c61\u4e00\u4e2a\u65e0\u9650\u653b\u51fb\u529b\u548c\u653b\u901f\u7684\u8c4c\u8c46\u5c04\u624b\u3002\uff08\u4e0d\u8003\u8651\u8fde\u6837\u4f8b\u90fd\u8fc7\u4e0d\u4e86\uff09\uff08\u4f46\u662f\u5c3d\u7ba1\u8fd9\u6837\u8fd8\u662f\u80fd\u591f\u62ff\u523080\u5206\uff09 <br>\n\u5177\u4f53\u5904\u7406\u65b9\u6cd5\u5c31\u5927\u529b\u4e0a\u4e00\u4e2a\u62d3\u6251\u6392\u5e8f\u5373\u53ef\u3002\u628a\u6240\u6709\u9700\u8981\u7f29\u6389\u7684\u70b9\u6253\u4e2a\u6807\u8bb0\uff0c\u7136\u540e\u4ee4\u8fd9\u4e9b\u70b9\u5728\u7f51\u7edc\u6d41\u4e2d\u4e0d\u5b58\u5728\u3002 <br>\n\u7136\u800c\uff0c\u5982\u679c\u6211\u4eec\u76f4\u63a5\u5199\u4e00\u4e2a\u62d3\u6251\u6392\u5e8f\u7684\u8bdd\uff0c\u8fd8\u662f\u53ea\u80fd\u5f97\u523080\u5206\u7684\u597d\u6210\u7ee9\u2014\u2014\u8fd9\u662f\u56e0\u4e3a\u8fd9\u5f20\u56fe\u9700\u8981\u5bf9\u53cd\u56fe\u8fdb\u884c\u62d3\u6251\u6392\u5e8f\u3002<br>\n\u7ec6\u60f3\uff0c\u56e0\u4e3a\u8fd9\u5f20\u56fe\u4e0a\u6bcf\u4e00\u6761\u6709\u5411\u8fb9\u7684\u7ec8\u70b9\u4e00\u65e6\u88ab\u5220\u53bb\uff0c\u90a3\u4e48\u5b83\u7684\u6240\u6709\u524d\u9a71\u4e5f\u90fd\u662f\u4e0d\u80fd\u5b58\u5728\u7684\u3002<br>\n\u6545\u800c\uff0c\u5bf9\u53cd\u56fe\u8fdb\u884c\u62d3\u6251\u6392\u5e8f\u627e\u73af\u5e76\u5220\u53bb\u624d\u80fd\u7b26\u5408\u9898\u76ee\u7684\u8981\u6c42\u3002 <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;queue>\n\nconst int INF=2147483647;\nconst int VERYBIG=0x3f3f3f3f;\n\ninline int Min(int A,int B){\n\treturn A&lt;B?A:B;\n}\n\nint n,m,s,t,nw[1005],dep[1005],val[1005];\n\nstruct ee{\n\tint v;\n\tint w;\n\tint nxt;\n}e[1000005];\nint h[1005],et=-1,in[1005];\ninline void Eadd(int U,int V,int W){\n\te[++et]=(ee){V,W,h[U]};\n\th[U]=et;\n}\ninline void add(int U,int V,int W){\n\tEadd(U,V,W);\n\tEadd(V,U,0);\n\t++in[U];\n}\n\nstd::queue&lt;int> q;\ninline bool bfs(){\n\tfor(int i=1;i&lt;=t;++i){\n\t\tnw[i]=h[i];\n\t\tif(dep[i]>-2){\t\t\n\t\t\tdep[i]=INF;\n\t\t}\n\t}\n\tq.push(s);\n\tdep[s]=0;\n\tint p;\n\twhile(!q.empty()){\n\t\tp=q.front();\n\t\tq.pop();\n\t\tfor(int i=h[p];i>=0;i=e[i].nxt){\n\t\t\tif(dep[e[i].v]==INF&amp;&amp;e[i].w){\n\t\t\t\tdep[e[i].v]=dep[p]+1;;\n\t\t\t\tq.push(e[i].v); \n\t\t\t}\n\t\t}\n\t}\n\/\/\tprintf(\"%d\\n\",dep[t]);\n\treturn dep[t]&lt;INF;\n}\n\ninline int dfs(int X,int V){\n\tif(!V||X==t){\n\t\treturn V;\n\t}\n\tint cnt=0,val;\n\tfor(int i=nw[X];i>=0;i=e[i].nxt){\n\t\tnw[X]=i;\n\t\tif(dep[e[i].v]==dep[X]+1){\n\t\t\tval=dfs(e[i].v,Min(e[i].w,V));\n\t\t\tif(val){\n\t\t\t\tV-=val;\n\t\t\t\tcnt+=val;\n\t\t\t\te[i].w-=val;\n\t\t\t\te[i^1].w+=val;\n\t\t\t\tif(!V){\n\t\t\t\t\tbreak;\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t}\n\treturn cnt;\n}\n\ninline int calc(int X,int Y){\n\treturn X*m+Y+1;\n}\n\ninline int dinic(){\n\tint ans=0;\n\twhile(bfs()){\n\t\tans+=dfs(s,INF);\n\t}\n\treturn ans;\n}\ninline int srt(){\n\tfor(int i=1;i&lt;=t;++i){\n\t\tif(!in[i]){\n\t\t\tq.push(i);\n\t\t}\n\t\tdep[i]=-2;\n\t}\n\tint RT=0,p;\n\twhile(!q.empty()){\n\t\tp=q.front();\n\t\tq.pop();\n\t\tdep[p]=0;\n\t\tif(val[p]>0){\n\t\t\tRT+=val[p];\n\t\t}\n\t\tfor(int i=h[p];i>=0;i=e[i].nxt){\n\t\t\tif(!e[i].w){\n\t\t\t\tif(!--in[e[i].v]){\n\t\t\t\t\tq.push(e[i].v);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn RT;\n}\n\nvoid init(){\n\tscanf(\"%d%d\",&amp;n,&amp;m);\n\ts=n*m+1,t=n*m+2,et=-1;\n\tfor(int i=1;i&lt;=t;++i){\n\t\th[i]=-1;\n\t}\n\tint x,y,z;\n\tfor(int i=1;i&lt;=n*m;++i){\n\t\tscanf(\"%d\",&amp;x);\n\t\tval[i]=x;\n\t\tx>0?(add(s,i,x),0):(x==0?0:(add(i,t,-x),0));\n\t\tscanf(\"%d\",&amp;x);\n\t\tfor(int j=1;j&lt;=x;++j){\n\t\t\tscanf(\"%d%d\",&amp;y,&amp;z);\n\t\t\tadd(calc(y,z),i,VERYBIG);\n\t\t}\n\t\tif(i%m){\n\t\t\tadd(i,i+1,VERYBIG);\n\t\t}\n\t}\n\tint tot=srt();\n\tprintf(\"%d\\n\",tot-dinic());\n}\n\nint main(){\n\tinit();\n\treturn 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ed4\u7ec6\u9605\u8bfb\u9898\u610f\uff0c\u6211\u4eec\u53d1\u73b0\uff0c\u8fd9\u9053\u9898\u672c\u8d28\u4e0a\u5c31\u662f\u4e00\u4e2a\u7ea6\u675f\u7c7b\u95ee\u9898\uff1a\u5bf9\u4e8e\u6bcf\u4e00\u682a\u690d\u7269\uff0c\u90fd\u5b58\u5728\u4e00\u4e9b\u690d\u7269\uff0c\u9700\u8981\u6d88\u706d\u6389\u5b83\u4eec\u624d\u80fd\u6d88\u706d &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2019\/01\/30\/lp2805-noi2009-%e6%a4%8d%e7%89%a9%e5%a4%a7%e6%88%98%e5%83%b5%e5%b0%b8\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201clp2805 NOI2009 \u690d\u7269\u5927\u6218\u50f5\u5c38\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":[50,30,33,81,77,6,75,5],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/575"}],"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=575"}],"version-history":[{"count":1,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/575\/revisions"}],"predecessor-version":[{"id":576,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/575\/revisions\/576"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=575"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}