正文
增加 39 行删除 39 行
70 行未改动7172737475767778796 行未改动868788899091929394959697989966 行未改动16616716816917017117217317417 行未改动19219319419519619719819920010 行未改动2112122132142152162172182192202212222232242252262272282293 行未改动233234235236237238239240241270 行未改动全部展开51251351451551651751851952014 行未改动53553653753853954054154254354454554654754854955055160 行未改动61261361461561661761861962047 行未改动66866967067167267367467567667767867968068168268368468517 行未改动70370470570670770870971071171271371471571671771871972072193 行未改动81581681781881982082182282314 行未改动83883984084184284384484584684784884985085185285385441 行未改动896897898899900901902903904139 行未改动全部展开104410451046104710481049105010511052105334 行未改动108810891090109110921093109410951096109747 行未改动114511461147114811491150115111521153173 行未改动全部展开1327132813291330133113321333133413351336133713381339134013411342134313441345114 行未改动全部展开1460146114621463146414651466146714681469147014711472147314741475105 行未改动全部展开158115821583158415851586158715881589144 行未改动全部展开70 行未改动for(int i=1;i<=Z;i++) f[1][i]=1;for(int i=1;i<n;i++){for(auto j : l1[i]) s1.insert(i);for(auto j : l2[i]) s2.insert(i);for(auto j : r1[i]) s1.erase(s1.find(j));for(auto j : r2[i]) s2.erase(s2.find(j));for(int j=1;j<=Z;j++) f[i+1][j]=f[i][j],g[j]=0;ll k=s2.empty() ? 0 : *s2.rbegin(),pre=0;for(int j=1;j<=Z;j++) g[j]=(f[i][j]-f[k][j]+mod)%mod;6 行未改动for(int i=1;i<=Z;i++) ans=(ans+f[n][i])%mod;write(ans);putchar('\n');s1.clear(),s2.clear();for(int i=0;i<=n;i++) l1[i].clear(),r1[i].clear(),l2[i].clear(),r2[i].clear();}int main(){freopen("string.in","r",stdin);freopen("string.out","w",stdout);int id,T=1;read(id);read(T);while(T--) solve();return 0;66 行未改动ll ksm(ll x,ll y){ll res=1;while(y){if(y&1) res=res*x%mod;x=x*x%mod,y>>=1;}return res;}ll n,t,f[N][N],g[N][N];17 行未改动for(int i=0;i<=n;i++) f[0][i]=1;//for(int i=1;i<=n;i++){for(int j=0;j<=n;j++){ll res=0;for(int k=0;k<i;k++) res=(res+f[k][j]*f[i-k-1][j+1]%mod*C(i-1,k)%mod)%mod;//结合k2与i-k1-k2-1g[i][j]=(g[i][j]+res*p%mod)%mod;if(j){ll res1=0;for(int k=0;k<i;k++) res1=(res1+f[k][j]*f[i-k-1][j-1]%mod*C(i-1,k)%mod)%mod;10 行未改动int main(){freopen("bracket.in","r",stdin);freopen("bracket.out","w",stdout);int T=1;init();read(T);while(T--) solve();return 0;}/*若存在位置 ) 前缀数量大于 ( 前缀数量不能使已经不合法的合法设f(i,j) 表示插入了i次,有j个前缀位置是0的合法概率分类讨论放在哪1. 放置 ()3 行未改动2. 放置 )(1) 放在前缀非0位置,不知道是否增加前缀为0(艹艹艹1) 放在前缀为0位置,如何判断不可行啊,不知道是否会搞掉>1的*/```270 行未改动全部展开1 69 14341 4 7 9 12 15 17 18 201 2 3 1 4 2 1 52 (1 3)4 (2 5)6 (4 7)14 行未改动结论:当一天的最小数+n>最大天数,从那天作为起点+n如何找这个天数和最小数?不好做啊递推。O(n)???每个区间内递增。不对啊fi=f(i-(a_j<i))+1*/```# R24 T260 行未改动struct h{ll dis,u;friend bool operator < (h a,h b){return a.dis>b.dis;}};priority_queue<h>q;void init(){for(int i=1;i<=n*(m+1);i++) head[i]=0;47 行未改动}int main(){// freopen("pokemon.in","r",stdin);// freopen("pokemon.out","w",stdout);int id,T;// read(id);read(T);while(T--) solve();return 0;}/*m个属性1.加能力2.揪着一项能力对决43 32 3 117 行未改动821757276 783362401 760000001570000001 700246226 600757652380000001 423513575 474035234315201473 300580025 2870234451 1 1每只最多只用一次最后一次雇佣一定用第n只加在场上的一定是不优的考虑上一个怎么由于这个属性已经没用了,因此要找的去挑战擂主的这个属性以外的属性要尽量小inf inf infinf/2 10 inf-1inf/2 2 193 行未改动1 69 14341 4 7 9 12 15 17 18 201 2 3 1 4 2 1 52 (1 3)4 (2 5)6 (4 7)14 行未改动结论:当一天的最小数+n>最大天数,从那天作为起点+n如何找这个天数和最小数?不好做啊递推。O(n)???每个区间内递增。不对啊fi=f(i-(a_j<i))+1*/```# R25 T241 行未改动}const ll N=2e5+10;ll n,m;ll x[N],y[N];ll nxt[N],pos[N],lst[N];ll days[N],ma,ps,ans[N];ll head[N],id;struct edge{ll v,next;139 行未改动全部展开那么正确性的概率为1/(2^10)第一次错的概率为(1-1/(2^10))*/```# R25 T3[P3203 [HNOI2010] 弹飞绵羊](https://www.luogu.com.cn/problem/P3203)## 题意34 行未改动if(x>9) write(x/10);putchar(x%10^48);}const ll N=2e5+10;int n,k[N],f[N],nxt[N];//跳出当前块最小步数,跳到哪个点int ks[N],len,l[N],r[N];int main(){// freopen("selfeval.in","r",stdin);// freopen("selfeval.out","w",stdout);read(n);47 行未改动}/*记录每个点跳出块外的第一个点及步数修改时就修改这个,块内修改*/```# R25 T4[P4383 [八省联考 2018] 林克卡特树](https://www.luogu.com.cn/problem/P4383)173 行未改动全部展开相当于x+1 0 0 0选两个位置,加减1或者选一个位置,加或减1- + - - +方案数……?1 1 2 2 1 40 1 0 -1 3x 0 1 0*/114 行未改动全部展开int cnt;int main(){// freopen("wangliang.in","r",stdin);// freopen("wangliang.out","w",stdout);read(n),read(r),read(c);// n=100000;// r=c=1000000;// srand(828281);for(int i=1;i<=n;i++){int x,y,op;read(x),read(y),read(op);// x=rand()+1,y=rand()+1,op=rand()%3+1;if(op==1){if(!mpx[x]) mpx[x]=++pts,ptw[pts]=0;if(!mpy[y]) mpy[y]=++pts,ptw[pts]=0;ptw[++pts]=1;105 行未改动全部展开inv[0]=pw[0]=1;ll tz=ksm(jz,mod-2);for(int i=1;i<=3e5;i++) pw[i]=pw[i-1]*jz%mod,inv[i]=inv[i-1]*tz%mod;}char st[N];int main(){// freopen("suoyong.in","r",stdin);// freopen("suoyong.out","w",stdout);// ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);144 行未改动全部展开70 行未改动7172737475767778796 行未改动868788899091929394959697989966 行未改动16616716816917017117217317417 行未改动19219319419519619719819920010 行未改动2112122132142152162172182192202212222232242252262272282293 行未改动233234235236237238239240241270 行未改动全部展开51251351451551651751851952014 行未改动53553653753853954054154254354454554654754854955055160 行未改动61261361461561661761861962047 行未改动66866967067167267367467567667767867968068168268368468517 行未改动70370470570670770870971071171271371471571671771871972072193 行未改动81581681781881982082182282314 行未改动83883984084184284384484584684784884985085185285385441 行未改动896897898899900901902903904139 行未改动全部展开104410451046104710481049105010511052105334 行未改动108810891090109110921093109410951096109747 行未改动114511461147114811491150115111521153173 行未改动全部展开1327132813291330133113321333133413351336133713381339134013411342134313441345114 行未改动全部展开1460146114621463146414651466146714681469147014711472147314741475105 行未改动全部展开158115821583158415851586158715881589144 行未改动全部展开70 行未改动for(int i=1;i<=Z;i++) f[1][i]=1;for(int i=1;i<n;i++){for(auto j : l1[i]) s1.insert(i);for(auto j : l2[i]) s2.insert(i);for(auto j : r1[i]) s1.erase(s1.find(j));for(auto j : r2[i]) s2.erase(s2.find(j));for(int j=1;j<=Z;j++) f[i+1][j]=f[i][j],g[j]=0;ll k=s2.empty() ? 0 : *s2.rbegin(),pre=0;for(int j=1;j<=Z;j++) g[j]=(f[i][j]-f[k][j]+mod)%mod;6 行未改动for(int i=1;i<=Z;i++) ans=(ans+f[n][i])%mod;write(ans);putchar('\n');s1.clear(),s2.clear();for(int i=0;i<=n;i++) l1[i].clear(),r1[i].clear(),l2[i].clear(),r2[i].clear();}int main(){freopen("string.in","r",stdin);freopen("string.out","w",stdout);int id,T=1;read(id);read(T);while(T--) solve();return 0;66 行未改动ll ksm(ll x,ll y){ll res=1;while(y){if(y&1) res=res*x%mod;x=x*x%mod,y>>=1;}return res;}ll n,t,f[N][N],g[N][N];17 行未改动for(int i=0;i<=n;i++) f[0][i]=1;//for(int i=1;i<=n;i++){for(int j=0;j<=n;j++){ll res=0;for(int k=0;k<i;k++) res=(res+f[k][j]*f[i-k-1][j+1]%mod*C(i-1,k)%mod)%mod;//结合k2与i-k1-k2-1g[i][j]=(g[i][j]+res*p%mod)%mod;if(j){ll res1=0;for(int k=0;k<i;k++) res1=(res1+f[k][j]*f[i-k-1][j-1]%mod*C(i-1,k)%mod)%mod;10 行未改动int main(){freopen("bracket.in","r",stdin);freopen("bracket.out","w",stdout);int T=1;init();read(T);while(T--) solve();return 0;}/*若存在位置 ) 前缀数量大于 ( 前缀数量不能使已经不合法的合法设f(i,j) 表示插入了i次,有j个前缀位置是0的合法概率分类讨论放在哪1. 放置 ()3 行未改动2. 放置 )(1) 放在前缀非0位置,不知道是否增加前缀为0(艹艹艹1) 放在前缀为0位置,如何判断不可行啊,不知道是否会搞掉>1的*/```270 行未改动全部展开1 69 14341 4 7 9 12 15 17 18 201 2 3 1 4 2 1 52 (1 3)4 (2 5)6 (4 7)14 行未改动结论:当一天的最小数+n>最大天数,从那天作为起点+n如何找这个天数和最小数?不好做啊递推。O(n)???每个区间内递增。不对啊fi=f(i-(a_j<i))+1*/```# R24 T260 行未改动struct h{ll dis,u;friend bool operator < (h a,h b){return a.dis>b.dis;}};priority_queue<h>q;void init(){for(int i=1;i<=n*(m+1);i++) head[i]=0;47 行未改动}int main(){// freopen("pokemon.in","r",stdin);// freopen("pokemon.out","w",stdout);int id,T;// read(id);read(T);while(T--) solve();return 0;}/*m个属性1.加能力2.揪着一项能力对决43 32 3 117 行未改动821757276 783362401 760000001570000001 700246226 600757652380000001 423513575 474035234315201473 300580025 2870234451 1 1每只最多只用一次最后一次雇佣一定用第n只加在场上的一定是不优的考虑上一个怎么由于这个属性已经没用了,因此要找的去挑战擂主的这个属性以外的属性要尽量小inf inf infinf/2 10 inf-1inf/2 2 193 行未改动1 69 14341 4 7 9 12 15 17 18 201 2 3 1 4 2 1 52 (1 3)4 (2 5)6 (4 7)14 行未改动结论:当一天的最小数+n>最大天数,从那天作为起点+n如何找这个天数和最小数?不好做啊递推。O(n)???每个区间内递增。不对啊fi=f(i-(a_j<i))+1*/```# R25 T241 行未改动}const ll N=2e5+10;ll n,m;ll x[N],y[N];ll nxt[N],pos[N],lst[N];ll days[N],ma,ps,ans[N];ll head[N],id;struct edge{ll v,next;139 行未改动全部展开那么正确性的概率为1/(2^10)第一次错的概率为(1-1/(2^10))*/```# R25 T3[P3203 [HNOI2010] 弹飞绵羊](https://www.luogu.com.cn/problem/P3203)## 题意34 行未改动if(x>9) write(x/10);putchar(x%10^48);}const ll N=2e5+10;int n,k[N],f[N],nxt[N];//跳出当前块最小步数,跳到哪个点int ks[N],len,l[N],r[N];int main(){// freopen("selfeval.in","r",stdin);// freopen("selfeval.out","w",stdout);read(n);47 行未改动}/*记录每个点跳出块外的第一个点及步数修改时就修改这个,块内修改*/```# R25 T4[P4383 [八省联考 2018] 林克卡特树](https://www.luogu.com.cn/problem/P4383)173 行未改动全部展开相当于x+1 0 0 0选两个位置,加减1或者选一个位置,加或减1- + - - +方案数……?1 1 2 2 1 40 1 0 -1 3x 0 1 0*/114 行未改动全部展开int cnt;int main(){// freopen("wangliang.in","r",stdin);// freopen("wangliang.out","w",stdout);read(n),read(r),read(c);// n=100000;// r=c=1000000;// srand(828281);for(int i=1;i<=n;i++){int x,y,op;read(x),read(y),read(op);// x=rand()+1,y=rand()+1,op=rand()%3+1;if(op==1){if(!mpx[x]) mpx[x]=++pts,ptw[pts]=0;if(!mpy[y]) mpy[y]=++pts,ptw[pts]=0;ptw[++pts]=1;105 行未改动全部展开inv[0]=pw[0]=1;ll tz=ksm(jz,mod-2);for(int i=1;i<=3e5;i++) pw[i]=pw[i-1]*jz%mod,inv[i]=inv[i-1]*tz%mod;}char st[N];int main(){// freopen("suoyong.in","r",stdin);// freopen("suoyong.out","w",stdout);// ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);144 行未改动全部展开