上一页 1 2 3 4 5 6 ··· 19 下一页
摘要: 题意 考虑转化下$f(S)$: 我们考虑$S$的$fail$树上的每一个点$x$,如果$x$到$0$的路径上有$cnt$个点(除去$x$和$0$),那么就会对$f(S)$产生$cnt$的贡献,于是现在$f(S)$变为了每个点会对很多点产生$1$的贡献,最后求和。 我们知道每个点代表一个前缀,那么我们 阅读全文
posted @ 2020-06-08 19:48 nofind 阅读(152) 评论(0) 推荐(1) 编辑
摘要: 题意 我们知道一个结论:\(\gcd(f_x,f_y)=f_{\gcd(x,y)}\)。 证明见这里。 于是我们考虑将$lcm$向$\gcd$方向化,我们知道$lcm$是给指数取$\max$,$\gcd$是给指数取$\min$,因此考虑$\min-\max$容斥: \(lcm(S)=\prod\li 阅读全文
posted @ 2020-06-05 19:43 nofind 阅读(198) 评论(1) 推荐(0) 编辑
摘要: 题意 先枚举一个点必须选,设该点为$x$。 将两棵树都以$x$为根,对于点$y$,如果选$y$必须要选$fa_y$,于是就变成了了最大权闭合子图。 code: #include<bits/stdc++.h> using namespace std; const int maxn=55; const 阅读全文
posted @ 2020-06-05 19:40 nofind 阅读(122) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-06-05 16:33 nofind 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 题意 考虑点分治来枚举树上联通块,对于一个联通块,我们做有依赖性的树形DP即可,需要用单调队列优化多重背包。 有依赖性的树形DP code: #include<bits/stdc++.h> using namespace std; const int maxn=510; const int maxm 阅读全文
posted @ 2020-06-05 14:28 nofind 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 题意 我们先换种方式说一下$kF_{x,y}$: 对于叶子点对$(x,y)$,设其$lca$为$z$。 我们对$z$也进行赋值,$na<nb$为$0$,反之则为$1$。 那么$kF_{x,y}$其实就是如果$x/y$和$z$的值相同,那么就会产生$F_{x,y}$的代价。 于是我们现在变成了点的代价 阅读全文
posted @ 2020-06-04 21:01 nofind 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 题意 算是第一道辛普森积分的题吧,这里有篇洛谷题解相当详细,这里就不赘述了。 code: #include<bits/stdc++.h> using namespace std; const int maxn=1010; const double eps=1e-7; int n; double al 阅读全文
posted @ 2020-06-04 15:04 nofind 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题意 二分半径,递归判断当前矩形是否能被覆盖。 code: #include<bits/stdc++.h> using namespace std; const int maxn=55; const double eps=1e-6; int T,K; double n,m; struct node{ 阅读全文
posted @ 2020-06-04 11:07 nofind 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题意 将$[l,r]$离线差分一下就变成了哈希冲突那道题了。 code: #include<bits/stdc++.h> using namespace std; const int maxn=1e5+10; const int maxa=10010; const int maxt=150; int 阅读全文
posted @ 2020-06-04 10:23 nofind 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 题目描述 小 H 是一位优秀的越野赛车女选手。现在她准备在 A 山上进行赛车训练。 A 山上一共有 n 个广场,编号依次为 1 到 n,这些广场之间通过 n−1 条双向车道直接或间接地连接在一起。对于每条车道 i,可以用四个正整数 ui,vi,li,ri 描述,表示车道连接广场 ui 和 vi,其速 阅读全文
posted @ 2020-06-04 10:05 nofind 阅读(164) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 19 下一页