摘要: 代码不想写就口胡了 1001.用 歌唱王国 的结论$E(A)=\sum_{i=1}^{len} a_{i}*m^i,\ a_{i}=is\_border(i)$回文串border就是回文自动机的fail直接上回文自动机比较字典序即可 1002. 1003.直接离线考虑每一位的贡献用个dfs序维护线段 阅读全文
posted @ 2020-07-28 21:06 asd123www 阅读(229) 评论(0) 推荐(0) 编辑
摘要: luogu p2472 直接最大流,拆点限制经过次数即可 #include <bits/stdc++.h> #define rep(i,l,r) for(int i=l;i<=r;++i) #define per(i,l,r) for(int i=r;i>=l;--i) using namespac 阅读全文
posted @ 2019-06-17 11:33 asd123www 阅读(313) 评论(0) 推荐(0) 编辑
摘要: day1 T1: 异或之 注意scanf输入u32的方式 #include <bits/stdc++.h> #define rep(a,b,i) for(int i=a;i<=b;++i) #define per(a,b,i) for(int i=a;i>=b;--i) using namespac 阅读全文
posted @ 2019-05-31 17:36 asd123www 阅读(493) 评论(2) 推荐(1) 编辑
摘要: 我们最常用的求一个字符串循环的算法是kmp。 结论: 设$len=n-nxt[n]$ (1) $nxt[n]=0$ 不存在循环节 (2) $nxt[n]>0$ $\&\&$ $n\%len\neq0$ 存在循环节但是长度不整除 (3) $nxt[n]>0$ $\&\&$ $n\%len=0$ 存在整 阅读全文
posted @ 2019-01-10 14:25 asd123www 阅读(1083) 评论(0) 推荐(0) 编辑
摘要: 话说min-max容斥的题真的多,所以来学一下。 假设先给每一个点一个$val$,我们想求一个集合$|S|$的$max\left \{ i\epsilon S,val_{i}\right \}$ 。 则$max(S)=\sum_{T\epsilon S} (-1)^{|T|+1}*min(T)$。 阅读全文
posted @ 2018-12-26 21:28 asd123www 阅读(247) 评论(0) 推荐(1) 编辑
摘要: 虽然凉了但是作业还是要做的。 Round 1(11.3) T1: 我们首先需要观察出最后的$cnt(o)-cnt(x)=begin(o)-begin(x)$或$cnt(o)-cnt(x)=begin(o)-begin(x)+1$ 1>$begin(o)>begin(x)$ 这样我们是必胜的,所以尽快 阅读全文
posted @ 2018-12-11 21:08 asd123www 阅读(534) 评论(1) 推荐(0) 编辑
摘要: A.几何冲刺 感觉自己的智商爆炸。 显然是按照极角序排列之后依次加点,判断是否有点。 保证一个点在两个角的范围内就OK了啊,想了半天叉积。。。 #include "triangles.h" #include <bits/stdc++.h> #define for1(a,b,i) for(int i= 阅读全文
posted @ 2018-11-04 16:05 asd123www 阅读(244) 评论(0) 推荐(0) 编辑
摘要: uoj的题目都挺好的。 A.新年的XOR 观察性质,$O(1)$的。 #include <bits/stdc++.h> #define for1(a,b,i) for(int i=a;i<=b;++i) #define FOR2(a,b,i) for(int i=a;i>=b;--i) using 阅读全文
posted @ 2018-11-01 21:37 asd123www 阅读(285) 评论(0) 推荐(0) 编辑
摘要: A.Oh Those Palindromes 直接排序之后输出就行了。 证明的话直接跟据同一种字符最多能在多少个回文串中贡献答案就行了。 #include <bits/stdc++.h> #define for1(a,b,i) for(int i=a;i<=b;++i) #define FOR2(a 阅读全文
posted @ 2018-10-25 17:16 asd123www 阅读(226) 评论(0) 推荐(0) 编辑
摘要: A.Cram Time 显然$a,b$都是被用完的,我们也只会用一个前缀。 #include <bits/stdc++.h> #define for1(a,b,i) for(int i=a;i<=b;++i) #define FOR2(a,b,i) for(int i=a;i>=b;--i) usi 阅读全文
posted @ 2018-10-24 15:24 asd123www 阅读(423) 评论(0) 推荐(0) 编辑