{"id":138,"date":"2025-12-14T14:52:12","date_gmt":"2025-12-14T06:52:12","guid":{"rendered":"http:\/\/107.172.44.235\/?p=138"},"modified":"2026-01-08T22:07:08","modified_gmt":"2026-01-08T14:07:08","slug":"codeforces%e8%a1%a5%e9%a2%98%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"http:\/\/hkhbest.xyz\/?p=138","title":{"rendered":"Codeforces\u8865\u9898\u7b14\u8bb0"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/codeforces.com\/contest\/2176\" target=\"_blank\"  rel=\"nofollow\" >Codeforces Round 1070 (Div. 2)<\/a><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">D\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8d5b\u65f6\u60f3\u7684\u5f88\u9ebb\u70e6\uff0c\u6ca1\u65f6\u95f4\u5199\u4e86\uff0c \u9898\u610f\u662f\u7ed9\u5b9a\u6709\u5411\u56fe\uff0c\u70b9\u4e0a\u67091e18\u4ee5\u5185\u7684\u6b63\u6743\u503c\uff0c\u53d6\u4e00\u6761\u7b80\u5355\u8def\u5f84\uff0c\u5982\u679c\u6ee1\u8db3\u6590\u6ce2\u90a3\u5951\u6570\u5217\u7684\u63a8\u5bfc\u5f0f\uff0c\u8fd9\u6761\u8def\u5f84\u5c31\u662f\u5408\u6cd5\u7684\uff0c\u6c42\u5408\u6cd5\u8def\u5f84\u53d6\u6a21\u603b\u6570\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u6bcf\u4e00\u6761\u8fb9\u8003\u8651\uff0c\u5982\u679c\u8fd9\u4e00\u6761\u8fb9\u662f\u6570\u5217\u7684\u8d77\u70b9\uff0c<math data-latex=\"f_{u,c_v}=\\Sigma (1+f_{v,c_u+c_v})\"><semantics><mrow><msub><mi>f<\/mi><mrow><mi>u<\/mi><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><mi>v<\/mi><\/msub><\/mrow><\/msub><mo>=<\/mo><mrow><mi mathvariant=\"normal\">\u03a3<\/mi><\/mrow><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mn>1<\/mn><mo>+<\/mo><msub><mi>f<\/mi><mrow><mi>v<\/mi><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><mi>u<\/mi><\/msub><mo>+<\/mo><msub><mi>c<\/mi><mi>v<\/mi><\/msub><\/mrow><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">f_{u,c_v}=\\Sigma (1+f_{v,c_u+c_v})<\/annotation><\/semantics><\/math>\uff0c\u5176\u4e2d <math data-latex=\"f_{u,c_v}\"><semantics><msub><mi>f<\/mi><mrow><mi>u<\/mi><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><mi>v<\/mi><\/msub><\/mrow><\/msub><annotation encoding=\"application\/x-tex\">f_{u,c_v}<\/annotation><\/semantics><\/math>\u8868\u793a\u4ece <math data-latex=\"u\"><semantics><mi>u<\/mi><annotation encoding=\"application\/x-tex\">u<\/annotation><\/semantics><\/math> \u51fa\u53d1\uff0c\u7b2c\u4e8c\u4e2a\u8282\u70b9\u6743\u503c\u4e3a <math data-latex=\"c_v\"><semantics><msub><mi>c<\/mi><mi>v<\/mi><\/msub><annotation encoding=\"application\/x-tex\">c_v<\/annotation><\/semantics><\/math> \u7684\u7b80\u5355\u8def\u5f84\u6570\u91cf\uff0c\u7136\u540e\u6309\u7167 <math data-latex=\"c_v\"><semantics><msub><mi>c<\/mi><mi>v<\/mi><\/msub><annotation encoding=\"application\/x-tex\">c_v<\/annotation><\/semantics><\/math> \u964d\u5e8f\u6392\u5e8f\uff0c\u5c31\u4fdd\u8bc1\u8fd9\u4e2a\u72b6\u6001\u8f6c\u79fb\u65b9\u7a0b\u53f3\u8fb9\u90fd\u5148\u4e8e\u5de6\u8fb9\u6c42\u51fa\u6765\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nconst int N=2e5+1000,M=2e5+1000,mod=998244353;\ninline int read()\n{\n    int s=0,w=1;char ch=getchar();\n    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}\n    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}\n    return s*w;\n}\nlong long ans,a&#91;N];\nint n,m;\nstruct edge\n{\n    int u,v;\n}e&#91;M];\nbool cmp(edge aaa,edge bbb)\n{\n    return a&#91;aaa.v]&gt;a&#91;bbb.v];\n}\n\nmap&lt;pair&lt;int,long long&gt;,long long&gt;f;\nvoid add(long long &amp;A,long long B)\n{\n    A=(A+B)%mod;\n}\nvoid work()\n{\n    f.clear();\n    ans=0;\n    n=read(); m=read();\n    for(int i=1;i&lt;=n;i++)\n        scanf(\"%lld\",&amp;a&#91;i]);\n    for(int i=1;i&lt;=m;i++)\n    {\n        e&#91;i].u=read();\n        e&#91;i].v=read();\n    }\n    sort(e+1,e+1+m,cmp);\n    for(int i=1;i&lt;=m;i++)\n    {\n        long long tmp=0;\n        add(tmp,f&#91;make_pair(e&#91;i].v,a&#91;e&#91;i].u]+a&#91;e&#91;i].v])]);\n        add(tmp,1);\n        add(f&#91;make_pair(e&#91;i].u,a&#91;e&#91;i].v])],tmp);\n        \/\/cout&lt;&lt;f&#91;make_pair(e&#91;i].u,a&#91;e&#91;i].v])]&lt;&lt;\"DEBUG\"&lt;&lt;endl;\n        add(ans,tmp);\n    }\n    printf(\"%lld\\n\",ans);\n}\nint main()\n{\n    int T;scanf(\"%d\",&amp;T);\n    while(T--)\n    {\n        work();\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">E\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8d5b\u4e2d\u770b\u90fd\u6ca1\u770b\u3002\u9898\u610f\u662f\u4e00\u4e2a\u5e8f\u5217\uff0c\u6bcf\u4e2a\u5143\u7d20\u6709\u4e00\u4e2a\u6743\u503c <math data-latex=\"a\"><semantics><mi>a<\/mi><annotation encoding=\"application\/x-tex\">a<\/annotation><\/semantics><\/math>\uff0c\u4e00\u4e2a\u5220\u9664\u6743\u503c <math data-latex=\"c\"><semantics><mi>c<\/mi><annotation encoding=\"application\/x-tex\">c<\/annotation><\/semantics><\/math>\uff0c\u6bcf\u6b21\u64cd\u4f5c\u53ef\u4ee5\u9009\u62e9\u76f8\u90bb\u4e24\u4e2a\u5143\u7d20\u5220\u6389 <math data-latex=\"a\"><semantics><mi>a<\/mi><annotation encoding=\"application\/x-tex\">a<\/annotation><\/semantics><\/math> \u8f83\u5c0f\u7684\u90a3\u4e2a\uff0c\u4ea7\u751f\u8f83\u5c0f\u7684 <math data-latex=\"c\"><semantics><mi>c<\/mi><annotation encoding=\"application\/x-tex\">c<\/annotation><\/semantics><\/math> \u7684\u82b1\u8d39\u3002\u5982\u679c <math data-latex=\"a\"><semantics><mi>a<\/mi><annotation encoding=\"application\/x-tex\">a<\/annotation><\/semantics><\/math> \u76f8\u540c\u53ef\u4ee5\u4efb\u53d6\u82b1\u8d39\u4e4b\u4e00\u3002\u63a5\u4e0b\u6765\u6309\u7167\u8f93\u5165\u7684\u6392\u5217\uff0c\u5143\u7d20\u7684 <math data-latex=\"c\"><semantics><mi>c<\/mi><annotation encoding=\"application\/x-tex\">c<\/annotation><\/semantics><\/math> \u9646\u7eed\u53d8\u6210 <math data-latex=\"0\"><semantics><mn>0<\/mn><annotation encoding=\"application\/x-tex\">0<\/annotation><\/semantics><\/math>\u3002\u95ee\u96f6\u5316\u524d\u3001\u6bcf\u96f6\u5316\u4e00\u4e2a\u5143\u7d20\uff0c\u628a\u539f\u5e8f\u5217\u5220\u6389\u5c31\u5269\u4e00\u4e2a\u5143\u7d20\u7684\u6700\u5c0f\u82b1\u8d39\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8003\u8651\u4e00\u4e2a\u5e8f\u5217\uff0c\u6700\u5927\u6743\u503c\u7684\u5143\u7d20\u4e0b\u6807\u5206\u522b\u4e3a <math data-latex=\"x_1,x_2,...,x_m\"><semantics><mrow><msub><mi>x<\/mi><mn>1<\/mn><\/msub><mo separator=\"true\">,<\/mo><msub><mi>x<\/mi><mn>2<\/mn><\/msub><mo separator=\"true\">,<\/mo><mi>.<\/mi><mi>.<\/mi><mi>.<\/mi><mo separator=\"true\">,<\/mo><msub><mi>x<\/mi><mi>m<\/mi><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">x_1,x_2,...,x_m<\/annotation><\/semantics><\/math>\uff0c\u663e\u7136\u4e00\u79cd\u6700\u4f18\u65b9\u6848\u662f\u5148\u628a\u975e\u6700\u5927\u503c\u7684\u5143\u7d20\u5220\u6389\u3001\u518d\u5220\u9664\u6700\u5927\u503c\u5143\u7d20\u3002\u5220\u9664\u6700\u5927\u503c\u8fd9\u4e00\u6b65\u4f1a\u5bf9\u7b54\u6848\u4ea7\u751f <math data-latex=\"m \\min(c_{x_1},c_{x_2},...,c_{x_m})\"><semantics><mrow><mi>m<\/mi><mrow><mspace width=\"0.1667em\"><\/mspace><mi>min<\/mi><mo>\u2061<\/mo><\/mrow><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>c<\/mi><msub><mi>x<\/mi><mn>1<\/mn><\/msub><\/msub><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><msub><mi>x<\/mi><mn>2<\/mn><\/msub><\/msub><mo separator=\"true\">,<\/mo><mi>.<\/mi><mi>.<\/mi><mi>.<\/mi><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><msub><mi>x<\/mi><mi>m<\/mi><\/msub><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">m \\min(c_{x_1},c_{x_2},...,c_{x_m})<\/annotation><\/semantics><\/math> \u7684\u5f71\u54cd\u3002\u6211\u4eec\u8003\u8651\u9012\u5f52\u7684\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u90a3\u4e48\u5728\u4e24\u4e2a\u6700\u5927\u503c\u5143\u7d20\u5939\u7740\u7684\u5b50\u533a\u95f4 \uff0c<math data-latex=\"\\min \"><semantics><mrow><mi>min<\/mi><mo>\u2061<\/mo><mspace width=\"0.1667em\"><\/mspace><\/mrow><annotation encoding=\"application\/x-tex\">\\min <\/annotation><\/semantics><\/math> \u4e2d\u7684\u5143\u7d20\u8fd8\u8981\u52a0\u4e0a\u8fd9\u4e24\u4e2a\u6700\u5927\u503c\u7684\u82b1\u8d39\u3002\u5373\uff1a<\/p>\n\n\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 19px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\"   class=\"lazyload\" data-src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-25048c91d4e17d7fc1605f7673445ade_l3.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  height=\"19\" width=\"527\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#102;&#40;&#108;&#44;&#114;&#44;&#120;&#41;&#61;&#32;&#102;&#40;&#108;&#44;&#120;&#95;&#49;&#45;&#49;&#44;&#98;&#41;&#43;&#102;&#40;&#120;&#95;&#49;&#43;&#49;&#44;&#120;&#95;&#50;&#45;&#49;&#44;&#98;&#41;&#43;&#92;&#100;&#111;&#116;&#115;&#43;&#102;&#40;&#120;&#95;&#109;&#43;&#49;&#44;&#114;&#44;&#98;&#41;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p >\n<noscript><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-25048c91d4e17d7fc1605f7673445ade_l3.png\" height=\"19\" width=\"527\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#102;&#40;&#108;&#44;&#114;&#44;&#120;&#41;&#61;&#32;&#102;&#40;&#108;&#44;&#120;&#95;&#49;&#45;&#49;&#44;&#98;&#41;&#43;&#102;&#40;&#120;&#95;&#49;&#43;&#49;&#44;&#120;&#95;&#50;&#45;&#49;&#44;&#98;&#41;&#43;&#92;&#100;&#111;&#116;&#115;&#43;&#102;&#40;&#120;&#95;&#109;&#43;&#49;&#44;&#114;&#44;&#98;&#41;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/noscript>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 19px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\"   class=\"lazyload\" data-src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-680176c44582453da018db8b835729af_l3.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  height=\"19\" width=\"181\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#98;&#61;&#92;&#109;&#105;&#110;&#40;&#120;&#44;&#99;&#95;&#123;&#120;&#95;&#49;&#125;&#44;&#92;&#100;&#111;&#116;&#115;&#44;&#99;&#95;&#123;&#120;&#95;&#109;&#125;&#41;&#32;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p >\n<noscript><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-680176c44582453da018db8b835729af_l3.png\" height=\"19\" width=\"181\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#98;&#61;&#92;&#109;&#105;&#110;&#40;&#120;&#44;&#99;&#95;&#123;&#120;&#95;&#49;&#125;&#44;&#92;&#100;&#111;&#116;&#115;&#44;&#99;&#95;&#123;&#120;&#95;&#109;&#125;&#41;&#32;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/noscript>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u9632\u6b62\u5206\u6cbb\u88ab\u5361\u5230n\u65b9\uff0c\u6211\u4eec\u8981\u6709\u4e00\u4e2alog\u7ea7\u7684\u627e\u533a\u95f4\u6700\u5927\u503c\u7684\u5de5\u5177\uff0c\u6240\u4ee5\u518d\u5efa\u7acb\u4e00\u9897\u7ebf\u6bb5\u6811\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u80fd\u6709\u4e00\u4e2anlogn\u7684\u5206\u6cbb\u7b97\u6cd5\u3002\u4e4b\u540e\u8003\u8651\u5143\u7d20\u5220\u9664\u4ee3\u4ef7\u7684\u96f6\u5316\uff0c\u96f6\u5316\u5c31\u76f8\u5f53\u4e8e\u5bf9\u67d0\u4e2a\u5b50\u6811\u7684\u8d21\u732e\u5f52\u96f6\uff0c\u6211\u4eec\u4fbf\u5229\u5206\u6cbb\u6811\uff0c\u5982\u679c\u662f\u4e00\u822c\u7684\u8282\u70b9\uff0c\u90a3\u4e48\u5c31\u662f\u51cf\u53bbm\u4e2a\u8d21\u732e\uff08\u67d0\u4e00\u4e2a\u5b50\u6811\u7684\u6700\u5927\u503c\u8282\u70b9\uff09\uff0c\u5982\u679c\u662f\u6839\u8282\u70b9\uff0c\u56e0\u4e3a\u8981\u7559\u4e0b\u4e00\u4e2a\u6570\uff08\u663e\u7136\u7559\u4e0b\u7684\u662f\u6574\u4e2a\u5e8f\u5217\u7684\u6700\u5927\u503c\uff09\uff0c\u5c31\u662f\u51cf\u53bbm-1\u4e2a\u8d21\u732e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nconst int N=2e5+1000,M=2e5+1000,mod=998244353,INF=0x7fffffff;\ninline int read()\n{\n    int s=0,w=1;char ch=getchar();\n    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}\n    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}\n    return s*w;\n}\nunordered_map&lt;int,int&gt;val;\nint n,a&#91;N],nxt&#91;N],tot,bel&#91;N],p&#91;N];\nbool vis&#91;N*8];\nlong long ans,c&#91;N];\n\n\nstruct tree\n{\n    int l,r,maxnid;\n}t&#91;N*8];\nvoid update(int p)\n{\n    int ls=p*2,rs=p*2+1;\n    if(a&#91;t&#91;ls].maxnid]&gt;=a&#91;t&#91;rs].maxnid])\n        t&#91;p].maxnid=t&#91;ls].maxnid;\n    else\n        t&#91;p].maxnid=t&#91;rs].maxnid;\n    return;\n}\nvoid build(int p,int l,int r)\n{\n    if(l==r)\n    {\n        t&#91;p].l=t&#91;p].r=t&#91;p].maxnid=l;\n        return;\n    }\n    t&#91;p].l=l;\n    t&#91;p].r=r;\n    int mid=(l+r)\/2;\n    build(p*2,l,mid);\n    build(p*2+1,mid+1,r);\n    update(p);\n    return;\n}\nint getmax(int p,int l,int r)\n{\n    if(l&gt;t&#91;p].r||r&lt;t&#91;p].l)\n    {\n        return 0;\n    }\n    else if(l&lt;=t&#91;p].l&amp;&amp;t&#91;p].r&lt;=r)\n    {\n        return t&#91;p].maxnid;\n    }\n    else\n    {\n        int ll=getmax(p*2,l,r),rr=getmax(p*2+1,l,r);\n        if(a&#91;ll]&gt;=a&#91;rr])\n            return ll;\n        else\n            return rr;\n    }\n}\n\n\nstruct fenzhi\n{\n    int l,r,b,m;\n    vector&lt;int&gt;v;\n    bool vis;\n}e&#91;N*8];\nlong long f(int p,int l,int r,long long b)\n{\n    vector&lt;int&gt;x;\n    e&#91;p].l=l;e&#91;p].r=r;\n    long long res=0;\n    int u=getmax(1,l,r),cnt=0;\n    \n    for(int i=u;l&lt;=i&amp;&amp;i&lt;=r;i=nxt&#91;i])\n    {\n        b=min(c&#91;i],b);\n        cnt++;\n        x.push_back(i);\n        bel&#91;i]=p;\n    }\n    e&#91;p].b=b;e&#91;p].m=cnt;\n    if(p==1)\n        res=1LL*(cnt-1)*b;\n    else\n        res=1LL*cnt*b;\n\n    if(x&#91;0]-1&gt;=l)\n    {\n        e&#91;p].v.push_back(++tot);\n        res+=f(tot,l,x&#91;0]-1,b);\n    }\n    for(int i=0;i&lt;cnt-1;i++)\n    {\n        if(x&#91;i+1]-1&gt;=x&#91;i]+1)\n        {\n            e&#91;p].v.push_back(++tot);\n            res+=f(tot,x&#91;i]+1,x&#91;i+1]-1,b);\n        }\n        \n    }\n    if(r&gt;=x&#91;cnt-1]+1)\n    {\n        e&#91;p].v.push_back(++tot);\n        res+=f(tot,x&#91;cnt-1]+1,r,b);\n    }\n    return res;\n}\nvoid guiling(int p)\n{\n    if(e&#91;p].vis)\n        return;\n    if(p==1)\n    {\n        ans-=1LL*e&#91;p].b*(e&#91;p].m-1);\n    }\n    else\n    {\n        ans-=1LL*e&#91;p].b*(e&#91;p].m);\n    }\n    e&#91;p].vis=1;\n    for(auto V:e&#91;p].v)\n    {\n        guiling(V);\n    }\n    return;\n    \n}\nvoid work()\n{\n    for(int i=0;i&lt;=tot;i++)\n    {\n        e&#91;i].l=e&#91;i].r=e&#91;i].vis=0;\n        e&#91;i].v.clear();\n    }\n    tot=0;\n    val.clear();\n    for(int i=0;i&lt;=n;i++)\n    {\n        a&#91;i]=c&#91;i]=nxt&#91;i]=0;\n    }\n    n=read();\n    for(int i=1;i&lt;=n;i++)\n    {\n        a&#91;i]=read();\n    }\n    for(int i=n;i&gt;=1;i--)\n    {\n        nxt&#91;i]=val&#91;a&#91;i]];\n        val&#91;a&#91;i]]=i;\n    }\n    for(int i=1;i&lt;=n;i++)\n    {\n        c&#91;i]=read();\n    }\n    for(int i=1;i&lt;=n;i++)\n    {\n        p&#91;i]=read();\n    }\n    build(1,1,n);\n\n    ++tot;\n    ans=f(1,1,n,INF);\n    printf(\"%lld \",ans);\n\n    for(int i=1;i&lt;=n;i++)\n    {\n        guiling(bel&#91;p&#91;i]]);\n        printf(\"%lld \",ans);\n    }\n    puts(\"\");\n}\nint main()\n{\n    int T;scanf(\"%d\",&amp;T);\n    while(T--)\n    {\n        work();\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">F\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u5165 2e5 \u5185\u7684\u6b63\u6574\u6570\u5e8f\u5217 <math data-latex=\"a\"><semantics><mi>a<\/mi><annotation encoding=\"application\/x-tex\">a<\/annotation><\/semantics><\/math> \uff0c\u6c42 <math data-latex=\"\\Sigma_{i&lt;j} \\omega(a_i\u00b7a_j)^k\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">\u03a3<\/mi><\/mrow><mrow><mi>i<\/mi><mo>&lt;<\/mo><mi>j<\/mi><\/mrow><\/msub><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mtext>\u00b7<\/mtext><msub><mi>a<\/mi><mi>j<\/mi><\/msub><msup><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mi>k<\/mi><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\Sigma_{i&lt;j} \\omega(a_i\u00b7a_j)^k<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><math data-latex=\"k\"><semantics><mi>k<\/mi><annotation encoding=\"application\/x-tex\">k<\/annotation><\/semantics><\/math> \u7684\u5b58\u5728\u4f7f\u5f97\u4ece\u6bcf\u4e2a\u8d28\u56e0\u6570\u65b9\u9762\u8003\u8651\u6210\u4e3a\u4e86\u4e0d\u53ef\u80fd\uff0c\u6709\u4e00\u4e2a\u53d8\u6362 <math data-latex=\"\\omega(a_i \\cdot a_j)=\\omega(a_i)+\\omega(a_j)-\\omega(\\gcd(a_i,a_j))\"><semantics><mrow><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mo>\u22c5<\/mo><msub><mi>a<\/mi><mi>j<\/mi><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>=<\/mo><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>+<\/mo><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>j<\/mi><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>\u2212<\/mo><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mrow><mi>gcd<\/mi><mo>\u2061<\/mo><\/mrow><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mo separator=\"true\">,<\/mo><msub><mi>a<\/mi><mi>j<\/mi><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo form=\"postfix\" stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">\\omega(a_i \\cdot a_j)=\\omega(a_i)+\\omega(a_j)-\\omega(\\gcd(a_i,a_j))<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u6211\u4eec\u5c31\u53d1\u73b0 2e5 \u8303\u56f4\u5185\uff0c\u8d28\u56e0\u6570\u4e2a\u6570\u6700\u591a\u4e3a 6\uff0c\u6240\u4ee5\u6211\u4eec\u8003\u8651\u7edf\u8ba1\u6bcf\u4e00\u4e2a\u6ee1\u8db3 <math data-latex=\" \\omega(a_i)+\\omega(a_j)\"><semantics><mrow><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>i<\/mi><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>+<\/mo><mi>\u03c9<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>a<\/mi><mi>j<\/mi><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\"> \\omega(a_i)+\\omega(a_j)<\/annotation><\/semantics><\/math> \u4e3a\u67d0\u4e2a\u5e38\u6570\u7684\u4e8c\u5143\u5bf9\u7684\u6570\u91cf\u3002\u8bbe <math data-latex=\"f_{g,c}\"><semantics><msub><mi>f<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><mi>c<\/mi><\/mrow><\/msub><annotation encoding=\"application\/x-tex\">f_{g,c}<\/annotation><\/semantics><\/math> \u8868\u793a gcd \u6070\u597d\u4e3ag\uff0c\u8d28\u56e0\u6570\u4e2a\u6570\u548c\u6070\u597d\u4e3ac\u7684\u4e8c\u5143\u5bf9\u5bf9\u6570\u3002\u5219\u4ece 0 \u5230 <math data-latex=\"\\max a\"><semantics><mrow><mrow><mi>max<\/mi><mo>\u2061<\/mo><mspace width=\"0.1667em\"><\/mspace><\/mrow><mi>a<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">\\max a<\/annotation><\/semantics><\/math>\uff0c\u4ece0\u523012\uff0c\u5206\u522b\u904d\u5386g\u548cc\uff0c\u7edf\u8ba1\u7b54\u6848\u5c31\u53ef\u4ee5\u4e86\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u8981\u6c42\u51fa <math data-latex=\"f\"><semantics><mi>f<\/mi><annotation encoding=\"application\/x-tex\">f<\/annotation><\/semantics><\/math>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u6570\u6bd4\u8f83\u96be\u6c42\uff0c\u8003\u8651\u80fd\u88ab g \u6574\u9664\uff0c\u8d28\u56e0\u6570\u4e2a\u6570\u4e3a\u67d0\u4e2a\u5e38\u6570\u7684\u5143\u7d20\u4e2a\u6570\uff0c\u5373 <math data-latex=\"cnt_{g,c}\"><semantics><mrow><mi>c<\/mi><mi>n<\/mi><msub><mi>t<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><mi>c<\/mi><\/mrow><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">cnt_{g,c}<\/annotation><\/semantics><\/math>\uff0c\u5219\u6709 <math data-latex=\"f_{g,c}=cnt_{g,c_1}*cnt_{g,c_2}(c_1*c_2=c)\"><semantics><mrow><msub><mi>f<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><mi>c<\/mi><\/mrow><\/msub><mo>=<\/mo><mi>c<\/mi><mi>n<\/mi><msub><mi>t<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><mn>1<\/mn><\/msub><\/mrow><\/msub><mo>\u2217<\/mo><mi>c<\/mi><mi>n<\/mi><msub><mi>t<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><msub><mi>c<\/mi><mn>2<\/mn><\/msub><\/mrow><\/msub><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>c<\/mi><mn>1<\/mn><\/msub><mo>\u2217<\/mo><msub><mi>c<\/mi><mn>2<\/mn><\/msub><mo>=<\/mo><mi>c<\/mi><mo form=\"postfix\" stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">f_{g,c}=cnt_{g,c_1}*cnt_{g,c_2}(c_1*c_2=c)<\/annotation><\/semantics><\/math> \u6216 <math data-latex=\"f_{g,2c}=cnt_{g,c}*(cnt_{g,c}-1)\/2\"><semantics><mrow><msub><mi>f<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><mn>2<\/mn><mi>c<\/mi><\/mrow><\/msub><mo>=<\/mo><mi>c<\/mi><mi>n<\/mi><msub><mi>t<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><mi>c<\/mi><\/mrow><\/msub><mo>\u2217<\/mo><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mi>c<\/mi><mi>n<\/mi><msub><mi>t<\/mi><mrow><mi>g<\/mi><mo separator=\"true\">,<\/mo><mi>c<\/mi><\/mrow><\/msub><mo>\u2212<\/mo><mn>1<\/mn><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mi>\/<\/mi><mn>2<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">f_{g,2c}=cnt_{g,c}*(cnt_{g,c}-1)\/2<\/annotation><\/semantics><\/math>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u4f1a\u7b97\u591a\u7684\u90e8\u5206\uff0c\u56e0\u4e3a f \u8981\u6c42 gcd \u6070\u597d\u4e3a g\uff0ccnt\u53ea\u8981\u6c42\u80fd\u88ab g \u6574\u9664\u3002\u6240\u4ee5\u6211\u4eec\u964d\u5e8f\u6c42 f\uff0c\u7136\u540e\u5bf9\u4e8e\u6bcf\u4e2ag\uff0c\u51cf\u53bb\u5bf9\u5e94\u76842g\uff0c3g\uff0c4g\u7b49\u7b49\u7684\u90e8\u5206\uff0c\u7531\u4e8e\u5f52\u7eb3\u7684\u6027\u8d28\uff0c\u5728\u6c42g\u4e3a\u6700\u5927\u503c\u7684\u65f6\u5019\u662f\u5bf9\u7684\uff0c\u540e\u9762\u90fd\u4e88\u4ee5\u4fee\u6b63\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nconst int N=2e5+1000,M=2e5+1000,mod=998244353,INF=0x7fffffff;\ninline int read()\n{\n    int s=0,w=1;char ch=getchar();\n    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}\n    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}\n    return s*w;\n}\n\nint a&#91;N],n,k;\nint w&#91;N],zhi&#91;N],tot;\nbool he&#91;N];\nlong long ans,cnt&#91;N]&#91;8]={0},f&#91;N]&#91;16]={0};;\nlong long qp(long long x,long long y)\n{\n    long long res=1,bas=x;\n    while(y&gt;0)\n    {\n        if(y&amp;1)\n        {\n            res=res*bas%mod;\n        }\n        bas=bas*bas%mod;\n        y&gt;&gt;=1;\n    }\n    return res;\n}\nint maxn=0;\nvoid work()\n{\n    for(int i = 1; i &lt;= maxn; i++) {\n        for(int j = 0; j &lt;= 6; j++) {\n            cnt&#91;i]&#91;j] = 0;\n        }\n        for(int j = 0; j &lt;= 12; j++) {\n            f&#91;i]&#91;j] = 0;\n        }\n    }\n    maxn=0;\n    ans=0;\n    n=read();k=read();\n    for(int i=1;i&lt;=n;i++)\n    {\n        a&#91;i]=read();\n        maxn=max(maxn,a&#91;i]);\n        int sqr=sqrt(a&#91;i]);\n        for(int j=1;j&lt;=sqr;j++)\n        {\n            if(a&#91;i]%j==0)\n            {\n                cnt&#91;j]&#91;w&#91;a&#91;i]]]++;\n                if(a&#91;i]!=j*j)\n                    cnt&#91;a&#91;i]\/j]&#91;w&#91;a&#91;i]]]++;\n            }\n        }\n    }\n    for(int i=maxn;i&gt;=1;i--)\n    {\n        for(int j=0;j&lt;=6;j++)\n        {\n            for(int k=j+1;k&lt;=6;k++)\n            {\n                f&#91;i]&#91;j+k]=(f&#91;i]&#91;j+k]+(cnt&#91;i]&#91;j]*cnt&#91;i]&#91;k])%mod)%mod;\n            }\n        }\n        for(int j=1;j&lt;=6;j++)\n        {\n            f&#91;i]&#91;2*j]=(f&#91;i]&#91;2*j]+cnt&#91;i]&#91;j]*(cnt&#91;i]&#91;j]-1)\/2%mod)%mod;\n        }\n        for(int j=2;1LL*j*i&lt;=maxn;j++)\n        {\n            for(int k=0;k&lt;=12;k++)\n            {\n                f&#91;i]&#91;k]=((f&#91;i]&#91;k]-f&#91;i*j]&#91;k])%mod+mod)%mod;\n            }\n        }\n    }\n    for(int i=1;i&lt;=maxn;i++)\n    {\n        for(int j=1;j&lt;=12;j++)\n        {\n            ans=(ans+qp(1LL*j-w&#91;i],1LL*k)*f&#91;i]&#91;j]%mod)%mod;\n        }\n    }\n    printf(\"%lld\\n\",ans);\n}\nint main()\n{\n    he&#91;1]=1;w&#91;1]=0;\n\tfor(int i=2;i&lt;=200000;i++)\n\t{\n\t\tif(!he&#91;i])\n\t\t{\n\t\t\tzhi&#91;++tot]=i;\n            w&#91;i]=1;\n\t\t}\n\t\tfor(int j=1;j&lt;=tot&amp;&amp;i*zhi&#91;j]&lt;=200000;j++)\n\t\t{\n\t\t\the&#91;i*zhi&#91;j]]=1 ;\n\t\t\tif(i%zhi&#91;j]==0)\n            {\n                w&#91;i*zhi&#91;j]]=w&#91;i];\n                break;\n            }\n\t\t\telse\n            {\n                w&#91;i*zhi&#91;j]]=w&#91;i]+1;\n            }\n\t\t}\n\t}\n    int T;scanf(\"%d\",&amp;T);\n    while(T--)\n    {\n        work();\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/codeforces.com\/contest\/2180\" target=\"_blank\"  rel=\"nofollow\" >Codeforces Global Round 31 (Div. 1 + Div. 2)<\/a><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">C\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8d5b\u65f6\u60f3\u7684\u8d85\u7ea7\u9ebb\u70e6\u8bd5\u4e86\u4e00\u5927\u5806\u6784\u9020\u5168\u88ab\u5361\u2026\u2026<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5947\u6570\u663e\u7136\uff0c\u8003\u8651\u5076\u6570\u60c5\u51b5\uff0c\u5f02\u6216\u95ee\u9898\u8fd8\u662f\u8981\u9010\u4f4d\u8003\u8651\uff01\u5bf9\u6bcf\u4e00\u4f4d\uff0c\u5982\u679cn\u6709\uff0c\u5b83\u5e94\u5f53\u51fa\u73b0\u5947\u6570\u6b21\uff0c\u5426\u5219\u5076\u6570\u6b21\u3002\u4e3a\u4e86\u8ba9\u603b\u548c\u6700\u5927\uff0c\u9ad8\u4f4d\u5e94\u8be5\u4f18\u5148\u88ab\u653e\u66f4\u591a\u6b21\uff0c\u6211\u4eec\u53d1\u73b0\u663e\u7136\u6700\u9ad8\u4f4d\u7684\u82e5\u5e72\u4e2a1\u90fd\u53ef\u4ee5\u88ab\u653e\u7f6ek-1\u6b21\u3002\u5982\u679c\u5b83\u4eec\u7f3a\u5931\u76841\u4f4d\u7f6e\u4ea4\u66ff\u5f00\uff0c\u5c31\u53ef\u4ee5\u4e0d\u8fbe\u5230n\u7684\u4e0a\u754c\uff0c\u65b9\u4fbf\u540e\u7eedn\u4e3a0\u7684\u4f4d\u7f6e\u586b1\u3002\u6240\u4ee5\u5bf9\u4e8en\u4e3a0\u7684\u4f4d\u6570\uff0c\u6211\u4eec\u770b\u4e00\u4e0b\u6709\u591a\u5c11\u4e2a\u6570\u5b57\u53ef\u4ee5\u586b\u7684\u8fdb\u53bb1\u800c\u4e0d\u8d85\u8fc7n\uff0c\u6211\u4eec\u4ece\u4e2d\u4efb\u9009\u5c3d\u53ef\u80fd\u591a\u7684\u5076\u6570\u4e2a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\n#define int long long\nusing namespace std;\ninline int lowbit(int x)\n{\n    return x&amp;(-x);\n}\ninline int read()\n{\n    int s=0,w=1;char ch=getchar();\n    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}\n    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}\n    return s*w;\n}\nint n,k,a&#91;110000],cnt;\nvoid work()\n{\n    cnt=0;\n    n=read();k=read();\n    if(!(k&amp;1))\n    {\n        for(int i=30;i&gt;=0;i--)\n        {\n            if(n&amp;(1&lt;&lt;i))\n            {\n                if(cnt&lt;k)\n                    cnt++;\n                for(int j=1;j&lt;=k;j++)\n                {\n                    if(j!=cnt)\n                        a&#91;j]+=(1&lt;&lt;i);\n                }\n            }\n            else\n            {\n                for(int j=1;j&lt;=cnt\/2*2;j++)\n                {\n                    a&#91;j]+=(1&lt;&lt;i);\n                }\n            }\n        }\n        for(int i=1;i&lt;=k;i++)\n        {\n            printf(\"%lld \",a&#91;i]);\n            a&#91;i]=0;\n        }\n        puts(\"\");\n            \n    }\n    else\n    {\n        for(int i=1;i&lt;=k;i++)\n            printf(\"%lld \",n);\n        puts(\"\");\n    }\n}\nsigned main()\n{\n    int T=1;T=read();\n    while(T--)\n    {\n        work();\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">D\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u9898\u6709\u4e24\u70b9\u8981\u6ce8\u610f\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bbe\u5f53\u524d\u534a\u5f84\u4e3a <math data-latex=\"x\"><semantics><mi>x<\/mi><annotation encoding=\"application\/x-tex\">x<\/annotation><\/semantics><\/math>\uff0c\u5219\u53ef\u4ee5\u5217\u4e00\u4e2a\u4e0d\u7b49\u5f0f\uff1a<math data-latex=\"0&lt; (x_{i-1}-x_{i-2})-(x_{i-2}-x_{i-3})+ ...&lt;x_{i}-x_{i-1}\"><semantics><mrow><mn>0<\/mn><mo>&lt;<\/mo><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>x<\/mi><mrow><mi>i<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo>\u2212<\/mo><msub><mi>x<\/mi><mrow><mi>i<\/mi><mo>\u2212<\/mo><mn>2<\/mn><\/mrow><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>\u2212<\/mo><mo form=\"prefix\" stretchy=\"false\">(<\/mo><msub><mi>x<\/mi><mrow><mi>i<\/mi><mo>\u2212<\/mo><mn>2<\/mn><\/mrow><\/msub><mo>\u2212<\/mo><msub><mi>x<\/mi><mrow><mi>i<\/mi><mo>\u2212<\/mo><mn>3<\/mn><\/mrow><\/msub><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>+<\/mo><mi>.<\/mi><mi>.<\/mi><mi>.<\/mi><mo>&lt;<\/mo><msub><mi>x<\/mi><mi>i<\/mi><\/msub><mo>\u2212<\/mo><msub><mi>x<\/mi><mrow><mi>i<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">0&lt; (x_{i-1}-x_{i-2})-(x_{i-2}-x_{i-3})+ ...&lt;x_{i}-x_{i-1}<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u5b58\u5728\u65ad\u70b9\u63d0\u524d\u800c\u66f4\u4f18\u79c0\u7684\u60c5\u51b5\uff0c\u56e0\u4e3a\u9650\u5236\u6761\u4ef6\u662f\u8d8a\u957f\u8d8a\u5927\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\nconst int N=2e6+1e4;\ninline int read()\n{\n    int s=0,w=1;char ch=getchar();\n    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}\n    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}\n    return s*w;\n}\nint n,x&#91;N];\nvoid work()\n{\n    n=read();\n    for(int i=1;i&lt;=n;i++)\n        x&#91;i]=read();\n    long long l=0,r=0x7fffffff,cur=0,fla=0;\n    int ans=n-1;\n    for(int i=2;i&lt;=n;i++,fla^=1)\n    {\n        cur=-cur+x&#91;i]-x&#91;i-1];\n        if(fla==0)\n        {\n            r=min(r,cur);\n            if(i&lt;n)\n                l=max(l,cur-(x&#91;i+1]-x&#91;i]));\n        }\n        else\n        {\n            l=max(l,-cur);\n            if(i&lt;n)\n                r=min(r,(x&#91;i+1]-x&#91;i])-cur);\n        }\n        if(l&gt;=r)\n        {\n            l=0;r=0x7fffffff;ans--;\n            cur=0;fla=1;\n        }\n    }\n    printf(\"%d\\n\",ans);\n    return;\n}\nint main()\n{\n    int T=1;T=read();\n    while(T--)\n    {\n        work();\n    }\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">E\u9898<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5148\u8ba4\u4e3a <math data-latex=\"0\"><semantics><mn>0<\/mn><annotation encoding=\"application\/x-tex\">0<\/annotation><\/semantics><\/math> \u5408\u6cd5\uff0c\u5e76\u8003\u8651 <math data-latex=\"f(l,r)\"><semantics><mrow><mi>f<\/mi><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mi>l<\/mi><mo separator=\"true\">,<\/mo><mi>r<\/mi><mo form=\"postfix\" stretchy=\"false\">)<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">f(l,r)<\/annotation><\/semantics><\/math> \u8868\u793a\u533a\u95f4 <math data-latex=\"[l,r]\"><semantics><mrow><mo form=\"prefix\" stretchy=\"false\">[<\/mo><mi>l<\/mi><mo separator=\"true\">,<\/mo><mi>r<\/mi><mo form=\"postfix\" stretchy=\"false\">]<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">[l,r]<\/annotation><\/semantics><\/math> \u7684\u7b54\u6848\u3002\u8bbe <math data-latex=\"k\"><semantics><mi>k<\/mi><annotation encoding=\"application\/x-tex\">k<\/annotation><\/semantics><\/math> \u4e3a <math data-latex=\"r\"><semantics><mi>r<\/mi><annotation encoding=\"application\/x-tex\">r<\/annotation><\/semantics><\/math> \u7684\u6700\u9ad8\u4f4d\uff0c\u5219\uff1a<\/p>\n\n\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 44px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\"   class=\"lazyload\" data-src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-141d1b8d066de30176dfd29c2fa31cbb_l3.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  height=\"44\" width=\"295\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#102;&#40;&#48;&#44;&#114;&#41;&#61;&#92;&#108;&#101;&#102;&#116;&#92;&#123;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#50;&#94;&#107;&#32;&#38;&#32;&#44;&#32;&#114;&#43;&#49;&#61;&#50;&#94;&#107;&#32;&#92;&#92; &#102;&#40;&#48;&#44;&#114;&#32;&#92;&#111;&#112;&#108;&#117;&#115;&#32;&#50;&#94;&#123;&#107;&#45;&#49;&#125;&#32;&#41;&#32;&#38;&#32;&#44;&#32;&#111;&#116;&#104;&#101;&#114;&#115; &#92;&#101;&#110;&#100;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#92;&#114;&#105;&#103;&#104;&#116;&#46;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p >\n<noscript><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-141d1b8d066de30176dfd29c2fa31cbb_l3.png\" height=\"44\" width=\"295\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#102;&#40;&#48;&#44;&#114;&#41;&#61;&#92;&#108;&#101;&#102;&#116;&#92;&#123;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#50;&#94;&#107;&#32;&#38;&#32;&#44;&#32;&#114;&#43;&#49;&#61;&#50;&#94;&#107;&#32;&#92;&#92; &#102;&#40;&#48;&#44;&#114;&#32;&#92;&#111;&#112;&#108;&#117;&#115;&#32;&#50;&#94;&#123;&#107;&#45;&#49;&#125;&#32;&#41;&#32;&#38;&#32;&#44;&#32;&#111;&#116;&#104;&#101;&#114;&#115; &#92;&#101;&#110;&#100;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#92;&#114;&#105;&#103;&#104;&#116;&#46;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/noscript>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u7531\u4e8e\u5982\u679c\u8fd9\u4e00\u4f4d\u586b <math data-latex=\"1\"><semantics><mn>1<\/mn><annotation encoding=\"application\/x-tex\">1<\/annotation><\/semantics><\/math> , <math data-latex=\"2^{k-1}-1 \"><semantics><mrow><msup><mn>2<\/mn><mrow><mi>k<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msup><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">2^{k-1}-1 <\/annotation><\/semantics><\/math>  \u4f1a\u88ab\u5f02\u6216\u5230 <math data-latex=\"2^k-1\"><semantics><mrow><msup><mn>2<\/mn><mi>k<\/mi><\/msup><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">2^k-1<\/annotation><\/semantics><\/math> ,\u8fd9\u8d85\u51fa\u4e86 <math data-latex=\"r\"><semantics><mi>r<\/mi><annotation encoding=\"application\/x-tex\">r<\/annotation><\/semantics><\/math>. \u6362\u8a00\u4e4b:<\/p>\n\n\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 44px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\"   class=\"lazyload\" data-src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-fb1ae787cd68d8f5d799fc986de4b07b_l3.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  height=\"44\" width=\"290\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#102;&#40;&#48;&#44;&#114;&#41;&#61;&#92;&#108;&#101;&#102;&#116;&#92;&#123;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#50;&#94;&#107;&#32;&#38;&#32;&#44;&#32;&#114;&#43;&#49;&#61;&#50;&#94;&#107;&#32;&#92;&#92; &#108;&#111;&#119;&#98;&#105;&#116;&#40;&#114;&#43;&#49;&#41;&#32;&#38;&#32;&#44;&#32;&#111;&#116;&#104;&#101;&#114;&#115; &#92;&#101;&#110;&#100;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#92;&#114;&#105;&#103;&#104;&#116;&#46;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p >\n<noscript><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-fb1ae787cd68d8f5d799fc986de4b07b_l3.png\" height=\"44\" width=\"290\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#32;&#32;&#102;&#40;&#48;&#44;&#114;&#41;&#61;&#92;&#108;&#101;&#102;&#116;&#92;&#123;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#50;&#94;&#107;&#32;&#38;&#32;&#44;&#32;&#114;&#43;&#49;&#61;&#50;&#94;&#107;&#32;&#92;&#92; &#108;&#111;&#119;&#98;&#105;&#116;&#40;&#114;&#43;&#49;&#41;&#32;&#38;&#32;&#44;&#32;&#111;&#116;&#104;&#101;&#114;&#115; &#92;&#101;&#110;&#100;&#123;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#92;&#114;&#105;&#103;&#104;&#116;&#46;&#32;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/noscript>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\u8003\u8651 <math data-latex=\"l \\ne 0\"><semantics><mrow><mi>l<\/mi><mo>\u2260<\/mo><mn>0<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">l \\ne 0<\/annotation><\/semantics><\/math>, \u663e\u7136\u6b64\u65f6 <math data-latex=\"l,r\"><semantics><mrow><mi>l<\/mi><mo separator=\"true\">,<\/mo><mi>r<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">l,r<\/annotation><\/semantics><\/math> \u7684\u5171\u540c\u9ad8\u4f4d\u662f\u6ca1\u6709\u610f\u4e49\u7684, \u4ee4 <math data-latex=\"k\"><semantics><mi>k<\/mi><annotation encoding=\"application\/x-tex\">k<\/annotation><\/semantics><\/math> \u4e3a\u4e24\u8005\u4e0d\u4e00\u81f4\u7684\u6700\u9ad8\u4f4d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u533a\u95f4\u5206\u4e3a <math data-latex=\"A=[0,l-1],B=[l,r],C=[r+1,2^{k+1}-1]\"><semantics><mrow><mi>A<\/mi><mo>=<\/mo><mo form=\"prefix\" stretchy=\"false\">[<\/mo><mn>0<\/mn><mo separator=\"true\">,<\/mo><mi>l<\/mi><mo>\u2212<\/mo><mn>1<\/mn><mo form=\"postfix\" stretchy=\"false\">]<\/mo><mo separator=\"true\">,<\/mo><mi>B<\/mi><mo>=<\/mo><mo form=\"prefix\" stretchy=\"false\">[<\/mo><mi>l<\/mi><mo separator=\"true\">,<\/mo><mi>r<\/mi><mo form=\"postfix\" stretchy=\"false\">]<\/mo><mo separator=\"true\">,<\/mo><mi>C<\/mi><mo>=<\/mo><mo form=\"prefix\" stretchy=\"false\">[<\/mo><mi>r<\/mi><mo>+<\/mo><mn>1<\/mn><mo separator=\"true\">,<\/mo><msup><mn>2<\/mn><mrow><mi>k<\/mi><mo>+<\/mo><mn>1<\/mn><\/mrow><\/msup><mo>\u2212<\/mo><mn>1<\/mn><mo form=\"postfix\" stretchy=\"false\">]<\/mo><\/mrow><annotation encoding=\"application\/x-tex\">A=[0,l-1],B=[l,r],C=[r+1,2^{k+1}-1]<\/annotation><\/semantics><\/math> \u4e09\u90e8\u5206, <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5219\u82e5 <math data-latex=\"|A| \\ne |C| \"><semantics><mrow><mi>|<\/mi><mi>A<\/mi><mi>|<\/mi><mo>\u2260<\/mo><mi>|<\/mi><mi>C<\/mi><mi>|<\/mi><\/mrow><annotation encoding=\"application\/x-tex\">|A| \\ne |C| <\/annotation><\/semantics><\/math> \u5219\u7b2c <math data-latex=\"k\"><semantics><mi>k<\/mi><annotation encoding=\"application\/x-tex\">k<\/annotation><\/semantics><\/math> \u4f4d\u7f6e\u53ea\u80fd\u586b <math data-latex=\"0.\"><semantics><mn>0.<\/mn><annotation encoding=\"application\/x-tex\">0.<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">G\u9898<\/p>\n\n\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 465px;\"><span class=\"ql-right-eqno\"> (1) <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\"   class=\"lazyload\" data-src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-a3e832075ad1733590e3c71ee1447c3d_l3.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/moezx\/cdn@3.0.2\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  height=\"465\" width=\"695\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#101;&#113;&#110;&#97;&#114;&#114;&#97;&#121;&#42;&#125; &#65;&#110;&#115;&#32;&#38;&#32;&#61;&#32;&#38;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#97;&#95;&#105;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#107;&#125;&#123;&#109;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#97;&#95;&#105;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#107;&#125;&#123;&#109;&#125;&#43;&#97;&#95;&#123;&#110;&#45;&#105;&#43;&#49;&#125;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#45;&#107;&#43;&#49;&#125;&#123;&#109;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#97;&#95;&#105;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#43;&#49;&#125;&#123;&#109;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#43;&#49;&#125;&#123;&#109;&#125;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#43;&#49;&#125;&#123;&#109;&#125;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#49;&#125;&#123;&#109;&#45;&#49;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#49;&#125;&#123;&#109;&#45;&#49;&#125;&#32;&#40;&#49;&#43;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#109;&#125;&#41;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#40;&#50;&#94;&#123;&#110;&#45;&#49;&#125;&#43;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#40;&#110;&#45;&#49;&#41;&#33;&#125;&#123;&#40;&#109;&#41;&#33;&#40;&#110;&#45;&#109;&#41;&#33;&#125;&#41;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#40;&#50;&#94;&#123;&#110;&#45;&#49;&#125;&#43;&#92;&#102;&#114;&#97;&#99;&#123;&#50;&#94;&#110;&#45;&#49;&#125;&#123;&#110;&#125;&#41;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#92; &#92;&#101;&#110;&#100;&#123;&#101;&#113;&#110;&#97;&#114;&#114;&#97;&#121;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p >\n<noscript><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hkhbest.xyz\/wp-content\/ql-cache\/quicklatex.com-a3e832075ad1733590e3c71ee1447c3d_l3.png\" height=\"465\" width=\"695\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#101;&#113;&#110;&#97;&#114;&#114;&#97;&#121;&#42;&#125; &#65;&#110;&#115;&#32;&#38;&#32;&#61;&#32;&#38;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#97;&#95;&#105;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#107;&#125;&#123;&#109;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#97;&#95;&#105;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#107;&#125;&#123;&#109;&#125;&#43;&#97;&#95;&#123;&#110;&#45;&#105;&#43;&#49;&#125;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#45;&#107;&#43;&#49;&#125;&#123;&#109;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#97;&#95;&#105;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#43;&#49;&#125;&#123;&#109;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#43;&#49;&#125;&#123;&#109;&#125;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#32;&#61;&#32;&#49;&#125;&#94;&#109;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#45;&#49;&#125;&#123;&#107;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#105;&#125;&#123;&#109;&#45;&#107;&#125;&#32;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#109;&#43;&#49;&#125;&#123;&#109;&#125;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#49;&#125;&#123;&#109;&#45;&#49;&#125;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#110;&#45;&#49;&#125;&#123;&#109;&#45;&#49;&#125;&#32;&#40;&#49;&#43;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#109;&#125;&#41;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#40;&#50;&#94;&#123;&#110;&#45;&#49;&#125;&#43;&#92;&#115;&#117;&#109;&#95;&#123;&#109;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#40;&#110;&#45;&#49;&#41;&#33;&#125;&#123;&#40;&#109;&#41;&#33;&#40;&#110;&#45;&#109;&#41;&#33;&#125;&#41;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#92; &#50;&#65;&#110;&#115;&#38;&#32;&#61;&#38;&#32;&#40;&#50;&#94;&#123;&#110;&#45;&#49;&#125;&#43;&#92;&#102;&#114;&#97;&#99;&#123;&#50;&#94;&#110;&#45;&#49;&#125;&#123;&#110;&#125;&#41;&#32;&#92;&#115;&#117;&#109;&#32;&#95;&#123;&#105;&#32;&#61;&#32;&#49;&#125;&#94;&#110;&#32;&#32;&#97;&#95;&#105;&#32;&#92;&#92; &#92;&#101;&#110;&#100;&#123;&#101;&#113;&#110;&#97;&#114;&#114;&#97;&#121;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/noscript>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b2c\u4e8c\u4e09\u6b65\u4ed9\u672f\u63a8\u5bfc\u662f\u56e0\u4e3a\u539f\u5e8f\u5217\u662f\u56de\u6587\u4ea7\u751f\u7684\u6027\u8d28.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\u6211\u4eec\u8003\u8651\u7ef4\u62a4\u5e8f\u5217\u7684\u548c\u3001\u5e8f\u5217\u957f\u5ea6, \u540e\u8005\u662f\u597d\u8bf4\u7684\uff08\u4f46\u662f\u516c\u5f0f\u91cc\u51fa\u73b0\u5728\u4e86\u5e42\u4e0a\uff0c\u6240\u4ee5\u8981\u5bf9\u6a21\u6570\u548c\u6a21\u6570-1\u540c\u65f6\u7ef4\u62a4\uff09 \u5bf9\u4e8e\u524d\u8005\u6211\u89c9\u5f97\u6709\u4e2a\u540c\u6837\u4ed9\u672f\u7684\u4e1c\u897f\u2026\u2026\u4f60\u628a\u6bcf\u6b21\u63d2\u5165\u64cd\u4f5c\u8bb0\u6210\u53ea\u5165\u4e0d\u51fa\u7684\u6808, \u5982\u679c\u662f\u5947\u6570\u957f\u5ea6\u65f6\u63d2\u5165\u5c31\u662f\u72b6\u6001 3, \u5426\u5219\u662f\u72b6\u6001 1, \u6bcf\u6b21\u4ece\u6808\u9876\u904d\u5386\u5e76\u628a\u72b6\u6001++\u540e\u5bf94\u53d6\u6a21, \u76f4\u5230\u9047\u5230\u4e86\u72b6\u6001 0,1 \u5c31\u662f\u4e2d\u95f4\u7684\u6570\uff08\u7136\u540e\u540c\u6837\u72b6\u6001++\u53d6\u6a21\u540ebreak\u6389\uff09\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h>\nusing namespace std;\nconst int N=2e6+1e4,mod=1e9+7;\ninline int read()\n{\n    int s=0,w=1;char ch=getchar();\n    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}\n    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}\n    return s*w;\n}\nint q;\nlong long sum,n1,n2;\nbool ji;\nlong long qp(long long a,long long b)\n{\n    long long res=1;\n    while(b)\n    {\n        if(b&amp;1)\n        {\n            res=res*a%mod;\n        }\n        a=a*a%mod;\n        b>>=1;\n    }\n    return res;\n}\nconst long long inv2=qp(2LL,1LL*mod-2);\nvector&lt;pair&lt;long long,int> >v;\nvoid work()\n{\n    v.clear();sum=0;n1=n2=0;ji=0;\n    int opt;\n    long long x;\n    q=read();ji=false;\n    while(q--)\n    {\n        opt=read();\n        \n        if(opt==1)\n        {\n            ji^=1;\n            for(int i=v.size()-1;i>=0;i--)\n            {\n                if(v&#91;i].second&lt;2)\n                {\n                    v&#91;i].second=(v&#91;i].second+1)%4;\n                    sum=((sum-v&#91;i].first)%mod+mod)%mod;\n                    break;\n                }\n                v&#91;i].second=(v&#91;i].second+1)%4;\n            }\n            \n            n1=(n1-1)%(mod-1)+mod-1;n1%=(mod-1);\n            n2=(n2-1)%mod+mod;n2%=mod;\n        }\n        else if(opt==2)\n        {\n            scanf(\"%lld\",&amp;x);\n            if(ji)\n            {\n                v.push_back(make_pair(x,3));\n                sum=(sum+x*(n2+1)%mod)%mod;\n            }\n            else\n            {\n                v.push_back(make_pair(x,1));\n                sum=(sum+x*(n2+1)%mod)%mod;\n                ji^=1;\n            }\n            n1=2*n1%(mod-1)+1;n1%=mod-1;\n            n2=(2*n2%mod+1)%mod;;\n        }\n        else\n        {\n            printf(\"%lld\\n\", inv2*sum%mod*((qp(2LL,(n1-1+mod-1)%(mod-1))+((qp(2LL,n1)-1)%mod+mod)%mod*qp(n2,mod-2)%mod)%mod   )%mod   );\n        }\n    }\n}\nint main()\n{\n    int T=1;T=read();\n    while(T--)\n    {\n        work();\n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Codeforces Round 1070 (Div. 2) D\u9898 \u8d5b\u65f6\u60f3\u7684\u5f88\u9ebb\u70e6\uff0c\u6ca1\u65f6\u95f4\u5199\u4e86\uff0c \u9898\u610f\u662f\u7ed9\u5b9a\u6709\u5411\u56fe\uff0c\u70b9\u4e0a\u67091e18 &#8230;<\/p>","protected":false},"author":1,"featured_media":154,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[19,3],"class_list":["post-138","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-icpc","tag-icpc","tag-3"],"_links":{"self":[{"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=138"}],"version-history":[{"count":24,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/posts\/138\/revisions"}],"predecessor-version":[{"id":184,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/posts\/138\/revisions\/184"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=\/wp\/v2\/media\/154"}],"wp:attachment":[{"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hkhbest.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}