版本比较
【抽象】2025 CSP 前的sm模拟赛 第三篇
正文
增加 39 行删除 39 行
70 行未改动717273747575767778796 行未改动8687888990909192939495959697989966 行未改动16616716816917017017117217317417 行未改动19219319419519619619719819920010 行未改动2112122132142152152162172182192202212212222232232242252252262272282293 行未改动233234235236237237238239240241270 行未改动全部展开51251351451551651651751851952014 行未改动53553653753853953954054154154254354454554654754754854955055160 行未改动61261361461561661661761861962047 行未改动66866967067167267267367467567667767867968068168068168268368468517 行未改动70370470570670770770870971071171271371471571571671771771871972072193 行未改动81581681781881981982082182282314 行未改动83883984084184284284384484484584684784884985085085185285385441 行未改动896897898899900900901902903904139 行未改动全部展开10441045104610471048104910481049105010511052105334 行未改动10881089109010911092109310921093109410951096109747 行未改动1145114611471148114911491150115111521153173 行未改动全部展开132713281329133013311331133213331333133413351335133613371338133913391340134113411342134313441345114 行未改动全部展开146014611462146314641464146514661467146814691470147114711472147314741475105 行未改动全部展开1581158215831584158515851586158715881589144 行未改动全部展开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 : 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(); 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; 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; 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-1 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-1 g[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(); init(); read(T); while(T--) solve(); return 0;}/*若存在位置 ) 前缀数量大于 ( 前缀数量 若存在位置 ) 前缀数量大于 ( 前缀数量
不能使已经不合法的合法 不能使已经不合法的合法
设f(i,j) 表示插入了i次,有j个前缀位置是0的合法概率 设f(i,j) 表示插入了i次,有j个前缀位置是0的合法概率
分类讨论放在哪
1. 放置 ()3 行未改动2. 放置 )(1) 放在前缀非0位置,不知道是否增加前缀为0(艹艹艹1) 放在前缀为0位置,如何判断
不可行啊,不知道是否会搞掉>1的 不可行啊,不知道是否会搞掉>1的
*/```270 行未改动全部展开1 69 14341 4 7 9 12 15 17 18 20
1 2 3 1 4 2 1 5 1 2 3 1 4 2 1 5
2 (1 3)4 (2 5)6 (4 7)14 行未改动
结论:当一天的最小数+n>最大天数,从那天作为起点+n如何找这个天数和最小数?
不好做啊 不好做啊
递推。 递推。
O(n)???
每个区间内递增。不对啊
fi=f(i-(a_j<i))+1 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; int id,T;// read(id); read(T); while(T--) solve(); return 0;}/*m个属性1.加能力 2.揪着一项能力对决 1.加能力2.揪着一项能力对决
43 32 3 117 行未改动821757276 783362401 760000001570000001 700246226 600757652380000001 423513575 474035234315201473 300580025 2870234451 1 1 1 1 1
每只最多只用一次
最后一次雇佣一定用第n只
加在场上的一定是不优的
考虑上一个怎么 考虑上一个怎么
由于这个属性已经没用了,因此要找的去挑战擂主的这个属性以外的属性要尽量小 由于这个属性已经没用了,因此要找的去挑战擂主的这个属性以外的属性要尽量小
inf inf infinf/2 10 inf-1inf/2 2 193 行未改动1 69 14341 4 7 9 12 15 17 18 20
1 2 3 1 4 2 1 5 1 2 3 1 4 2 1 5
2 (1 3)4 (2 5)6 (4 7)14 行未改动
结论:当一天的最小数+n>最大天数,从那天作为起点+n如何找这个天数和最小数?
不好做啊 不好做啊
递推。 递推。
O(n)???
每个区间内递增。不对啊
fi=f(i-(a_j<i))+1 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 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 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
- + - - + - + - - +
方案数……?
1 1 2 2 1 4 1 1 2 2 1 4
0 1 0 -1 3 0 1 0 -1 3
x 0 1 0*/
114 行未改动全部展开int cnt;int main(){// freopen("wangliang.in","r",stdin);// freopen("wangliang.out","w",stdout); read(n),read(r),read(c); 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; // 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]; 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 行未改动全部展开