博客园 首页 私信博主 显示目录 隐藏目录 管理 动画
摘要: 题意:求一个较大的多重背包对于每个i的方案数,答案对998244353取模。 思路: 生成函数: 对于一个$V$ 设: $f(x) = \sum_{i=0}^{oo} x ^ {V i} = {1 \over {1 x ^ V}}$ 那么就是求这个生成函数的积。 首先将$f(x)$取$ln$为$g( 阅读全文
posted @ 2018-09-03 21:58 Allorkiya 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题意:统计本质不同的串的个数。 思路: 显然后缀自动机,对于每个串建一个$SAM$统计即可。 c++ include using namespace std; int root; int lst; int tot; const int maxn = 2000010; const int mod = 阅读全文
posted @ 2018-09-03 18:51 Allorkiya 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题意:自己搜吧。。。 思路: 记二元组$(x,l)$表示当前为$x$且之前有$l$个连续数与$x$相同。 并且维护up和low数组表示取到最大/最小值时,连续序列的长度。 正一遍,反一遍,搞定。 我排序手抖达成$a.r and b.r$,调了1小时... c++ include using name 阅读全文
posted @ 2018-09-03 16:58 Allorkiya 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 题目:从u到v经过多少条边。 思路: 考虑他是怎么走的?? 从$u$到$v$一定是$fa[u]$,$fa[fa[u]]$,反正就是走$LCA$,那么如果算出每个点到父亲的期望步数,和父亲到该点的期望步数就可做了。 设$f(x) : x fa,g(x) : fa x$. 那么: $f(x) = {1 阅读全文
posted @ 2018-09-03 16:20 Allorkiya 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 题目: 求有多少组二元组$(l,r)$使得:$1O(nlogn)$ 离线处理:$x$在区间内出现了多少次即可。 总复杂度:$O(nlogn)$ c++ pragma GCC optimize(2) include using namespace std; define ll long long co 阅读全文
posted @ 2018-09-03 15:45 Allorkiya 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 思路: 就是考虑一个结论 对于$1 mod$时,显然取模为0,所以出题人很好心的没有给$10^{18}$的点。 代码我不知道为什么老是爆炸... c++ include using namespace std; define ll long long const int mod = 1e6+3; i 阅读全文
posted @ 2018-09-03 14:46 Allorkiya 阅读(219) 评论(0) 推荐(0) 编辑
摘要: $T1$ 直接考虑二分就可以了。。。 二分spfa判断,直接AC一发! $T2$ 推式子题。。。其实如果不想推的话可以直接高精。。。 c++ include using namespace std; define ll long long const int maxn = 4010; const i 阅读全文
posted @ 2018-09-03 13:06 Allorkiya 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题意:求满足题意的方案数。 思路: 显然的计数类$dp$。 不难发现,令$f(x) = \prod_{i=1}^{2m}{x_i} $. 在找一个$x'$使得$f(x') = \prod_{i=1}^{2m}{n/x_i}$ 那么,$f(x') = n^{2m}/f(x) n^m$ 所以说,对于$$ 阅读全文
posted @ 2018-09-03 11:26 Allorkiya 阅读(289) 评论(0) 推荐(0) 编辑