{"id":1249,"date":"2019-08-13T14:57:50","date_gmt":"2019-08-13T06:57:50","guid":{"rendered":"https:\/\/0self.mnihyc.com\/blog\/?p=1249"},"modified":"2020-04-22T21:10:55","modified_gmt":"2020-04-22T13:10:55","slug":"yzoj-p4444-apio2019%e8%b7%af%e7%81%af","status":"publish","type":"post","link":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249","title":{"rendered":"YZOJ P4444 [APIO2019]\u8def\u706f"},"content":{"rendered":"<h1 style=\"text-align: center;\">YZOJ P4444 [APIO2019]\u8def\u706f<\/h1>\n<p style=\"text-align: center;\">\u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB<\/p>\n<p style=\"text-align: center;\">\u96be\u5ea6\uff1a<span style=\"color: #ff6600;\">\\(7.0\\)<\/span><\/p>\n<ul>\n<li>\n<h3><strong>\u9898\u76ee\u63cf\u8ff0<\/strong><\/h3>\n<\/li>\n<\/ul>\n<p>\u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 \\(Innopolis\\) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 \\(n+1\\) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 \\(n\\) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c \\(i\\) \u4e2a\u8def\u706f\u4eae\u8d77\uff0c\u5b83\u5c06\u7167\u4eae\u8fde\u63a5\u7b2c \\(i\\) \u4e0e\u7b2c \\(i+1\\)\u4e2a\u7ad9\u70b9\u7684\u8def\u6bb5\u3002\u5426\u5219\u8fd9\u6761\u8def\u6bb5\u5c06\u662f\u9ed1\u6697\u7684\u3002<\/p>\n<p>\u51fa\u4e8e\u5b89\u5168\u6027\u7684\u8003\u8651\uff0c\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u53ea\u80fd\u884c\u9a76\u5728\u88ab\u7167\u4eae\u7684\u8def\u6bb5\u4e0a\u3002\u6362\u8a00\u4e4b\uff0c\u7684\u58eb\u80fd\u4ece\u7ad9\u70b9 \\(a\\) \u51fa\u53d1\u5230\u8fbe\u7ad9\u70b9 \\(b\\) \\((a&lt;b)\\) \u7684\u6761\u4ef6\u662f\uff1a\u8fde\u63a5\u7ad9\u70b9 \\(a\\) \u4e0e \\(a+1\\)\uff0c\\(a+1\\) \u4e0e \\(a+2, \\cdots ,b-1\\) \u4e0e \\(b\\) \u7684\u8def\u6bb5\u90fd\u88ab\u7167\u4eae\u3002<\/p>\n<p>\u5728\u7ecf\u8fc7\u4e00\u4e9b\u610f\u5916\u6545\u969c\u6216\u4fee\u7406\u4e4b\u540e\uff0c\u8857\u9053\u4e0a\u7684\u8def\u706f\u53ef\u80fd\u662f\u4eae\u8d77\u7684\uff0c\u4e5f\u53ef\u80fd\u662f\u7184\u706d\u7684\u3002<\/p>\n<p>\u73b0\u5728\u7ed9\u5b9a \\(0\\) \u65f6\u523b\u65f6\uff0c\u8857\u9053\u4e0a\u8def\u706f\u7684\u521d\u59cb\u72b6\u6001\u3002\u4e4b\u540e \\(1,2,\\cdots,q\\) \u65f6\u523b\uff0c\u6bcf\u65f6\u523b\u4f1a\u53d1\u751f\u4e0b\u5217\u4e24\u79cd\u4e8b\u4ef6\u4e4b\u4e00\uff1a<\/p>\n<p>\\(toggle i\\)\uff1a\u5207\u6362\u7b2c \\(i\\) \u4e2a\u8def\u706f\u7684\u72b6\u6001\u3002\u5177\u4f53\u5730\u8bf4\uff0c\u82e5\u8def\u706f\u539f\u6765\u4eae\u8d77\uff0c\u5219\u73b0\u5728\u5c06\u7184\u706d\uff1b\u82e5\u8def\u706f\u539f\u6765\u7184\u706d\uff0c\u5219\u73b0\u5728\u5c06\u4eae\u8d77\u3002<\/p>\n<p>\\(query a b\\)\uff1a\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u90e8\u95e8\u7684\u8d1f\u8d23\u4eba\u60f3\u77e5\u9053\uff0c\u4ece \\(0\\) \u65f6\u523b\u8d77\u5230\u5f53\u524d\u65f6\u523b\uff0c\u6709\u591a\u5c11\u4e2a\u65f6\u523b\u6ee1\u8db3\uff1a\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u80fd\u591f\u4ece\u7ad9\u70b9 \\(a\\) \u51fa\u53d1\u5230\u8fbe\u7ad9\u70b9 \\(b\\) \u3002<\/p>\n<p>\u8bf7\u4f60\u5e2e\u52a9\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u90e8\u95e8\u7684\u8d1f\u8d23\u4eba\u56de\u7b54\u4ed6\u4eec\u7684\u95ee\u9898\u3002<\/p>\n<ul>\n<li>\n<h3><strong>\u8f93\u5165\u683c\u5f0f<\/strong><\/h3>\n<\/li>\n<\/ul>\n<p>\u7b2c\u4e00\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570 \\(n\\) \u548c \\(q\\) \\((1 \\leq n,q \\leq 300000)\\) &#8212;- \u8868\u793a\u8def\u706f\u7684\u6570\u91cf\u4e0e\u65f6\u523b\u6570\u3002<\/p>\n<p>\u7b2c\u4e8c\u884c\u5305\u542b\u4e00\u4e2a\u5b57\u7b26\u4e32 \\(s\\) \u8868\u793a\u8def\u706f\u7684\u521d\u59cb\u72b6\u6001 \\((\\left|s\\right| = n)\\)\uff0c \\(s_i\\) \u4e3a \\(1\\) \u8868\u793a\u7b2c \\(i\\) \u4e2a\u8def\u706f\u521d\u59cb\u65f6\u4eae\u8d77\uff1b \\(s_i\\) \u4e3a \\(0\\) \u8868\u793a\u7b2c \\(i\\) \u4e2a\u8def\u706f\u521d\u59cb\u65f6\u7184\u706d\u3002<\/p>\n<p>\u63a5\u4e0b\u6765 \\(q\\) \u884c\u6bcf\u884c\u63cf\u8ff0\u4e00\u4e2a\u65f6\u523b\u7684\u4e8b\u4ef6\u3002\u7b2c \\(i\\) \u884c\u63cf\u8ff0\u65f6\u523b \\(i\\) \u6240\u53d1\u751f\u7684\u4e8b\u4ef6\u3002<\/p>\n<p>\\(toggle i\\) \\((1 \\leq i \\leq n)\\)\uff1a\u8be5\u65f6\u523b\u5207\u6362\u4e86\u7b2c \\(i\\) \u4e2a\u8def\u706f\u7684\u72b6\u6001\u3002<\/p>\n<p>\\(query a b\\) \\((1 \\leq a &lt; b \\leq n+1)\\)\uff1a\u8ba1\u7b97\u4ece \\(0\\) \u65f6\u523b\u8d77\u5230\u8be5\u65f6\u523b\uff0c\u5171\u6709\u591a\u5c11\u4e2a\u65f6\u523b\u6ee1\u8db3\u7684\u58eb\u80fd\u4ece\u7ad9\u70b9 \\(a\\) \u51fa\u53d1\u5230\u8fbe\u7ad9\u70b9 \\(b\\) \u3002<\/p>\n<p>\u81f3\u5c11\u6709\u4e00\u4e2a\u65f6\u523b\u7684\u4e8b\u4ef6\u662f \\(query\\) \u3002<\/p>\n<ul>\n<li>\n<h3><strong>\u8f93\u51fa\u683c\u5f0f<\/strong><\/h3>\n<\/li>\n<\/ul>\n<p>\u5bf9\u4e8e\u6bcf\u4e2a \\(query\\) \u7684\u4e8b\u4ef6\uff0c\u8f93\u51fa\u4e00\u884c\u5355\u4e2a\u6574\u6570\uff0c\u8868\u793a\u8be5\u95ee\u9898\u7684\u7b54\u6848\u3002<\/p>\n<p><!--more--><\/p>\n<ul>\n<li>\n<h3><strong>\u6837\u4f8b\u8f93\u5165<\/strong><\/h3>\n<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">5 7\r\n11011\r\nquery 1 2\r\nquery 1 2\r\nquery 1 6\r\nquery 3 4\r\ntoggle 3\r\nquery 3 4\r\nquery 1 6<\/pre>\n<ul>\n<li>\n<h3><strong>\u6837\u4f8b\u8f93\u51fa<\/strong><\/h3>\n<\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">1\r\n2\r\n0\r\n0\r\n1\r\n2<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><!--more--><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/ \u539f 2019.07.13<\/p>\n<p>\u672c\u9898\u6709\u591a\u79cd\u505a\u6cd5<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u8be2\u95ee \\(a, b\\) \uff0c\u5b83\u7684\u7b54\u6848\u5c31\u662f\u6240\u6709\u7ecf\u8fc7\u65f6\u523b\u4e2d\u533a\u95f4 \\([a, b]\\) \u5185\u7684\u503c\u5168\u4e3a \\(1\\) \u7684\u60c5\u51b5\u6570\u3002<\/p>\n<p>\u6240\u4ee5\u53ef\u4ee5\u8003\u8651\u7ef4\u62a4<strong>\u6781\u5927\u8fde\u901a \\(1\\) \u7684\u5b50\u6bb5<\/strong>\uff0c \u8bbe\u5176<strong>\u51fa\u73b0\u65f6\u95f4<\/strong>\u4e3a \\(t\\) \uff0c\u90a3\u4e48\u5c31\u4f1a\u6709\u4e00\u4e2a\u4e09\u5143\u7ec4 \\(\\left(l,r,t\\right)\\) \u3002<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u8be2\u95ee \\(a,b\\) \u4ee5\u53ca\u65f6\u523b \\(i\\) \uff0c\u8981\u6c42\u7684\u5c31\u662f\u6ee1\u8db3 \\(a \\geq l, \\; b \\leq r, \\; i \\geq t\\) \u5e76\u4e14\u6ca1\u6709\u88ab\u5220\u9664\u7684<strong>\u4e09\u5143\u7ec4 \\(\\left(l,r,t\\right)\\) \u7684\u4e2a\u6570<\/strong>\u3002<\/p>\n<p>\u95ee\u9898\u8f6c\u5316\u4e3a<strong>\u4e09\u7ef4\u504f\u5e8f<\/strong>\uff0c\u53ef\u4ee5\u5927\u529b\u6811\u5957\u6811 \u6216\u8005 \u76f4\u63a5\u4e0aCDQ\u7ef4\u62a4\u3002<\/p>\n<p>\u540c\u6837\uff0c\u589e\u52a0\/\u5220\u9664\/\u8be2\u95ee \u8fd9\u4e09\u79cd\u64cd\u4f5c\u7684<strong>\u987a\u5e8f<\/strong>\u8981\u641e\u6e05\u695a\u3002<\/p>\n<p>\u5173\u4e8e\u7ef4\u62a4<strong>\u6781\u5927\u8fde\u901a \\(1\\) \u7684\u5b50\u6bb5<\/strong>\uff0c\u53ef\u4ee5\u4f7f\u7528 ODT \u3002<\/p>\n<p>\u4e0d\u8fc7\u672c\u9898\u4e2d\u4e5f\u53ef\u4ee5\u4e0d\u4f7f\u7528\u3002<\/p>\n<p>\u65e2\u7136\u7ef4\u62a4\u533a\u95f4\u6709\u70b9\u96be\u5ea6\uff0c\u90a3\u5c31\u53ef\u4ee5\u7ef4\u62a4<strong>\u6240\u6709 \\(0\\) \u7684\u70b9\u7684\u4f4d\u7f6e<\/strong>\uff0c\u8dd1\u4e00\u904d<strong>\u521d\u59cb\u5316<\/strong>\u540e\u540c\u6837\u53ef\u4ee5\u5feb\u901f\u627e\u5230\u9700\u8981 \u5220\u9664\/\u589e\u52a0 \u7684\u533a\u95f4\u3002<\/p>\n<p>\uff08\u540e\u6ce8\uff1a\u8fd9\u662f\u56e0\u4e3a\u672c\u9898\u4e2d\u4fee\u6539\u662f<strong>\u5355\u70b9\u4fee\u6539<\/strong>\uff0c\u53ef\u4ee5\u4e0d\u9700\u8981<strong>\u533a\u95f4\u63a8\u5e73\uff08assign\uff09<\/strong>\u8fd9\u4e2a\u64cd\u4f5c\u3002\uff09<\/p>\n<p>\u4e0d\u8fc7\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u672c\u9898\u4e2d\u4e09\u5143\u7ec4<strong>\u5bf9\u7b54\u6848\u7684\u8d21\u732e<\/strong>\u4e0e\u666e\u901a\u504f\u5e8f\u95ee\u9898\u7a0d\u6709\u533a\u522b\u3002<\/p>\n<p>\u6ee1\u8db3\u6761\u4ef6\u5e76\u4e14<strong>\u6ca1\u6709\u88ab\u5220\u9664<\/strong>\u7684\u4e09\u5143\u7ec4 \\(\\left(l, r, t\\right)\\) \u5bf9\u8be2\u95ee \\(\\left(a, b, i\\right)\\) \u7684<strong>\u8d21\u732e\u4e3a \\(i-t\\)<\/strong> \u3002<\/p>\n<p>\u4e0d\u8fc7\u6ce8\u610f\u5230\u65e0\u8bba\u5728 \\(x\\) \u65f6\u523b\u662f<strong>\u589e\u52a0<\/strong>\u8fd8\u662f<strong>\u5220\u9664<\/strong>\u4e00\u4e2a\u4e09\u5143\u7ec4\uff0c\u5bf9\u8be5\u8be2\u95ee\u7684\u8d21\u732e\u90fd\u53ea\u662f<strong>\u52a0\u4e0a<\/strong>\u6216\u8005<strong>\u51cf\u53bb \\(i-x\\)<\/strong> \u3002<\/p>\n<p>\uff08\u51fa\u73b0\u65f6\u95f4\u4e3a \\(t_1\\) \uff0c\u6d88\u5931\u65f6\u95f4\u4e3a \\(t_2\\)\uff0c\u90a3\u4e48\u6709 \\(ans=t_2-t_1=+(i-t_1)-(i-t_2)\\)\uff0c\u5176\u4f59\u60c5\u51b5\u540c\u7406\uff09<\/p>\n<p>\u6240\u4ee5CDQ\u7684\u65f6\u5019\u5f00\u4e24\u4e2a\u6811\u72b6\u6570\u7ec4\u5206\u522b\u5b58 \\(\\sum 1\\) \u548c \\(\\sum x\\) \u5373\u53ef\u3002<\/p>\n<p>\u65f6\u95f4\u590d\u6742\u5ea6 \\(O\\left(n \\log^2 n\\right)\\) \u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \">#include &lt;cstdio&gt;\r\n#include &lt;cstdlib&gt;\r\n#include &lt;cstring&gt;\r\n#include &lt;climits&gt;\r\n#include &lt;ext\/pb_ds\/assoc_container.hpp&gt;\r\n#include &lt;ext\/pb_ds\/tree_policy.hpp&gt;\r\n\r\n#ifdef ONLINE_JUDGE\r\n\tchar __B[1&lt;&lt;15],*__S=__B,*__T=__B;\r\n\t#define getchar() (__S==__T&amp;&amp;(__T=(__S=__B)+fread(__B,1,1&lt;&lt;15,stdin),__S==__T)?EOF:*__S++)\r\n#endif\r\ninline int getnum()\r\n{\r\n\tregister char c=0;\r\n\twhile(!(c&gt;='0' &amp;&amp; c&lt;='9') &amp;&amp; c!='q' &amp;&amp; c!='t')\r\n\t\tc=getchar();\r\n\tif(c=='q')\r\n\t\treturn 2;\r\n\telse if(c=='t')\r\n\t\treturn 0;\r\n\tregister int a=0;\r\n\twhile(c&gt;='0' &amp;&amp; c&lt;='9')\r\n\t\ta=a*10+c-'0',c=getchar();\r\n\treturn a;\r\n}\r\n\r\nstruct _query\r\n{\r\n\tint type,l,r,time;\r\n}res[2050505],tres[2050505];\r\nint lq,lans,ans[305050];\r\n\r\nint N,fs[305050],fo[305050];\r\n#define _lowbit(_x) ((_x)&amp;-(_x))\r\n\r\nint __x,__ans;\r\n#define update(_f,_x,_val) \\\r\n({ \\\r\n\t__x=_x; \\\r\n\twhile(__x &lt;= N) \\\r\n\t{ \\\r\n\t\t_f[__x]+=_val; \\\r\n\t\t__x+=_lowbit(__x); \\\r\n\t} \\\r\n})\r\n\r\n#define query(_f,_x) \\\r\n({ \\\r\n\t__ans=0,__x=_x; \\\r\n\twhile(__x) \\\r\n\t{ \\\r\n\t\t__ans+=_f[__x]; \\\r\n\t\t__x-=_lowbit(__x); \\\r\n\t} \\\r\n\t__ans; \\\r\n})\r\n\r\nvoid CDQ_Divide(register int l,register int r)\r\n{\r\n\tif(l==r)\r\n\t\treturn;\r\n\tregister int mid=(l+r)&gt;&gt;1,tl=l,tr=mid+1;\r\n\t\r\n\tCDQ_Divide(l,mid),CDQ_Divide(mid+1,r);\r\n\t\r\n\tregister int j=l;\r\n\tfor(register int i=mid+1;i&lt;=r;i++)\r\n\t{\r\n\t\twhile(j&lt;=mid &amp;&amp; res[j].l&lt;=res[i].l)\r\n\t\t{\r\n\t\t\tif(res[j].type &lt; 2)\r\n\t\t\t\tupdate(fs,res[j].r,res[j].type),\r\n\t\t\t\tupdate(fo,res[j].r,res[j].type*res[j].time);\r\n\t\t\tj++;\r\n\t\t}\r\n\t\tif(res[i].type &gt;= 2)\r\n\t\t\tans[res[i].type]+=(query(fs,N)-query(fs,res[i].r-1))*res[i].time\r\n\t\t\t\t\t\t\t-(query(fo,N)-query(fo,res[i].r-1));\r\n\t}\r\n\tfor(register int i=l;i&lt;j;i++)\r\n\t\tif(res[i].type &lt; 2)\r\n\t\t\tupdate(fs,res[i].r,-res[i].type),\r\n\t\t\tupdate(fo,res[i].r,-res[i].type*res[i].time);\r\n\t\r\n\tfor(register int i=l;i&lt;=r;i++)\r\n\t\tif(tr&gt;r || (tl&lt;=mid &amp;&amp; res[tl].l&lt;res[tr].l))\r\n\t\t\ttres[i]=res[tl++];\r\n\t\telse\r\n\t\t\ttres[i]=res[tr++];\r\n\tfor(register int i=l;i&lt;=r;i++)\r\n\t\tres[i]=tres[i];\r\n}\r\n\r\nchar s[305050];\r\ntypedef __gnu_pbds::tree&lt;int,__gnu_pbds::null_type&gt; _t;\r\ntypedef _t::point_iterator _it;\r\n_t pre;\r\n\r\nint main()\r\n{\r\n\tregister int N=getnum(),Q=getnum();\r\n\t::N=N;\r\n\t\r\n\twhile((s[1]=getchar())!='0' &amp;&amp; s[1]!='1');\r\n\tfor(register int i=2;i&lt;=N;i++)\r\n\t\ts[i]=getchar();\r\n\tpre.insert(0),pre.insert(N+1);\r\n\tfor(register int i=1;i&lt;=N;i++)\r\n\t\tif(s[i]=='0')\r\n\t\t\tpre.insert(i);\r\n\t\telse\r\n\t\t{\r\n\t\t\tres[++lq]=(_query){1,i,0,0};\r\n\t\t\twhile(i&lt;=N &amp;&amp; s[i]=='1')\r\n\t\t\t\ti++;\r\n\t\t\tres[lq].r=(--i);\r\n\t\t}\r\n\t\r\n\tlans=1;\r\n\tfor(register int i=1,x;i&lt;=Q;i++)\r\n\t\tif(getnum()==2)\r\n\t\t\tres[++lq]=(_query){++lans,getnum(),getnum()-1,i};\r\n\t\telse\r\n\t\t\tif(s[x=getnum()]=='0')\r\n\t\t\t{\r\n\t\t\t\t_it pit=pre.find(x),nit=pit--,it=nit++;\r\n\t\t\t\tif(*pit+1 &lt;= x-1)\r\n\t\t\t\t\tres[++lq]=(_query){-1,*pit+1,x-1,i};\r\n\t\t\t\tif(x+1 &lt;= *nit-1)\r\n\t\t\t\t\tres[++lq]=(_query){-1,x+1,*nit-1,i};\r\n\t\t\t\tres[++lq]=(_query){1,*pit+1,*nit-1,i};\r\n\t\t\t\ts[x]='1',pre.erase(it);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t_it pit=pre.insert(x).first,nit=pit--,it=nit++;\r\n\t\t\t\tres[++lq]=(_query){-1,*pit+1,*nit-1,i};\r\n\t\t\t\tif(*pit+1 &lt;= x-1)\r\n\t\t\t\t\tres[++lq]=(_query){1,*pit+1,x-1,i};\r\n\t\t\t\tif(x+1 &lt;= *nit-1)\r\n\t\t\t\t\tres[++lq]=(_query){1,x+1,*nit-1,i};\r\n\t\t\t\ts[x]='0';\r\n\t\t\t}\r\n\tCDQ_Divide(1,lq);\r\n\t\r\n\tfor(register int i=2;i&lt;=lans;i++)\r\n\t\tprintf(\"%d\\n\",ans[i]);\r\n\t\r\n\treturn 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>YZOJ P4444 [APIO2019]\u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB  &hellip; <a href=\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">YZOJ P4444 [APIO2019]\u8def\u706f<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,64,71],"tags":[],"class_list":["post-1249","post","type-post","status-publish","format-standard","hentry","category-crazya","category-cdqdivide","category-balancedtree"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>YZOJ P4444 [APIO2019]\u8def\u706f - mnihyc&#039;s Blog<\/title>\n<meta name=\"description\" content=\"YZOJ P4444 \u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB \u96be\u5ea6\uff1a \u9898\u76ee\u63cf\u8ff0 \u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 (Innopolis) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 (n+1) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 (n) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c (i)\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"YZOJ P4444 [APIO2019]\u8def\u706f - mnihyc&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"YZOJ P4444 \u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB \u96be\u5ea6\uff1a \u9898\u76ee\u63cf\u8ff0 \u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 (Innopolis) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 (n+1) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 (n) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c (i)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\" \/>\n<meta property=\"og:site_name\" content=\"mnihyc&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-13T06:57:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-22T13:10:55+00:00\" \/>\n<meta name=\"author\" content=\"mnihyc\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mnihyc\" \/>\n<meta name=\"twitter:site\" content=\"@mnihyc\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"mnihyc\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#article\",\"isPartOf\":{\"@id\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\"},\"author\":{\"name\":\"mnihyc\",\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751\"},\"headline\":\"YZOJ P4444 [APIO2019]\u8def\u706f\",\"datePublished\":\"2019-08-13T06:57:50+00:00\",\"dateModified\":\"2020-04-22T13:10:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\"},\"wordCount\":149,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751\"},\"articleSection\":[\"7.0 ~ 8.0\",\"CDQ\u5206\u6cbb\",\"\u5e73\u8861\u6811\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\",\"url\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\",\"name\":\"YZOJ P4444 [APIO2019]\u8def\u706f - mnihyc&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#website\"},\"datePublished\":\"2019-08-13T06:57:50+00:00\",\"dateModified\":\"2020-04-22T13:10:55+00:00\",\"description\":\"YZOJ P4444 \u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB \u96be\u5ea6\uff1a \u9898\u76ee\u63cf\u8ff0 \u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 \\\\(Innopolis\\\\) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 \\\\(n+1\\\\) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 \\\\(n\\\\) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c \\\\(i\\\\)\",\"breadcrumb\":{\"@id\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/0.mnihyc.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"YZOJ P4444 [APIO2019]\u8def\u706f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#website\",\"url\":\"https:\/\/0.mnihyc.com\/blog\/\",\"name\":\"mnihyc&#039;s Blog\",\"description\":\"Welcome!\",\"publisher\":{\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/0.mnihyc.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751\",\"name\":\"mnihyc\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8d111f863afc3f98816bc96220f97077d470a96f41088de9f19530fc480f8e72?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8d111f863afc3f98816bc96220f97077d470a96f41088de9f19530fc480f8e72?s=96&d=mm&r=g\",\"caption\":\"mnihyc\"},\"logo\":{\"@id\":\"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"YZOJ P4444 [APIO2019]\u8def\u706f - mnihyc&#039;s Blog","description":"YZOJ P4444 \u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB \u96be\u5ea6\uff1a \u9898\u76ee\u63cf\u8ff0 \u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 (Innopolis) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 (n+1) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 (n) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c (i)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249","og_locale":"zh_CN","og_type":"article","og_title":"YZOJ P4444 [APIO2019]\u8def\u706f - mnihyc&#039;s Blog","og_description":"YZOJ P4444 \u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB \u96be\u5ea6\uff1a \u9898\u76ee\u63cf\u8ff0 \u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 (Innopolis) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 (n+1) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 (n) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c (i)","og_url":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249","og_site_name":"mnihyc&#039;s Blog","article_published_time":"2019-08-13T06:57:50+00:00","article_modified_time":"2020-04-22T13:10:55+00:00","author":"mnihyc","twitter_card":"summary_large_image","twitter_creator":"@mnihyc","twitter_site":"@mnihyc","twitter_misc":{"\u4f5c\u8005":"mnihyc","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#article","isPartOf":{"@id":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249"},"author":{"name":"mnihyc","@id":"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751"},"headline":"YZOJ P4444 [APIO2019]\u8def\u706f","datePublished":"2019-08-13T06:57:50+00:00","dateModified":"2020-04-22T13:10:55+00:00","mainEntityOfPage":{"@id":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249"},"wordCount":149,"commentCount":0,"publisher":{"@id":"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751"},"articleSection":["7.0 ~ 8.0","CDQ\u5206\u6cbb","\u5e73\u8861\u6811"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/0self.mnihyc.com\/blog\/archives\/1249#respond"]}]},{"@type":"WebPage","@id":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249","url":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249","name":"YZOJ P4444 [APIO2019]\u8def\u706f - mnihyc&#039;s Blog","isPartOf":{"@id":"https:\/\/0.mnihyc.com\/blog\/#website"},"datePublished":"2019-08-13T06:57:50+00:00","dateModified":"2020-04-22T13:10:55+00:00","description":"YZOJ P4444 \u8def\u706f \u65f6\u95f4\u9650\u5236\uff1a5000MS \u00a0\u00a0\u00a0\u00a0 \u5185\u5b58\u9650\u5236\uff1a524288KB \u96be\u5ea6\uff1a \u9898\u76ee\u63cf\u8ff0 \u4e00\u8f86\u81ea\u52a8\u9a7e\u9a76\u7684\u58eb\u6b63\u5728 \\(Innopolis\\) \u7684\u8857\u9053\u4e0a\u884c\u9a76\u3002\u8be5\u8857\u9053\u4e0a\u6709 \\(n+1\\) \u4e2a\u505c\u8f66\u7ad9\u70b9\uff0c\u5b83\u4eec\u5c06\u8857\u9053\u5212\u5206\u6210\u4e86 \\(n\\) \u6761\u8def\u6bb5\u3002\u6bcf\u4e00\u8def\u6bb5\u90fd\u62e5\u6709\u4e00\u4e2a\u8def\u706f\u3002\u5f53\u7b2c \\(i\\)","breadcrumb":{"@id":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/0self.mnihyc.com\/blog\/archives\/1249"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/0self.mnihyc.com\/blog\/archives\/1249#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/0.mnihyc.com\/blog"},{"@type":"ListItem","position":2,"name":"YZOJ P4444 [APIO2019]\u8def\u706f"}]},{"@type":"WebSite","@id":"https:\/\/0.mnihyc.com\/blog\/#website","url":"https:\/\/0.mnihyc.com\/blog\/","name":"mnihyc&#039;s Blog","description":"Welcome!","publisher":{"@id":"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/0.mnihyc.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/61e167d6d591fdd20dcfee2cf848a751","name":"mnihyc","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8d111f863afc3f98816bc96220f97077d470a96f41088de9f19530fc480f8e72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8d111f863afc3f98816bc96220f97077d470a96f41088de9f19530fc480f8e72?s=96&d=mm&r=g","caption":"mnihyc"},"logo":{"@id":"https:\/\/0.mnihyc.com\/blog\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/posts\/1249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/comments?post=1249"}],"version-history":[{"count":1,"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/posts\/1249\/revisions"}],"predecessor-version":[{"id":1708,"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/posts\/1249\/revisions\/1708"}],"wp:attachment":[{"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/media?parent=1249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/categories?post=1249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/0self.mnihyc.com\/blog\/wp-json\/wp\/v2\/tags?post=1249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}