随笔分类 -  其他

上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 33 下一页
摘要:大体上的思路不算太难,但是细节巨多无比. 注意我们必须要选一个,所以在记录极差的同时还要记录一下上一次出现的位置. code: #include <cstdio> #include <algorithm> #define setIO(s) freopen(s".in","r",stdin) usin 阅读全文
posted @ 2019-12-25 20:54 EM-LGH 阅读(203) 评论(0) 推荐(0)
摘要:这个黑白染色的思路真的是很巧妙啊 code: #include <cstdio> #include <string> #include <algorithm> #define ll long long using namespace std; namespace IO { void setIO(st 阅读全文
posted @ 2019-12-25 20:20 EM-LGH 阅读(292) 评论(0) 推荐(0)
摘要:非常有趣的一道题.... code: #include <cstdio> #include <string> #include <algorithm> using namespace std; namespace IO { void setIO(string s) { string in=s+".i 阅读全文
posted @ 2019-12-25 14:59 EM-LGH 阅读(166) 评论(0) 推荐(0)
摘要:code: #include <cstdio> #include <string> #include <algorithm> #define N 500005 #define inf 0.0000000001 using namespace std; namespace IO { void setI 阅读全文
posted @ 2019-12-25 09:35 EM-LGH 阅读(138) 评论(0) 推荐(0)
摘要:这道题的思路很神啊 ~ #include <cstdio> #include <string> #include <cstring> #include <algorithm> using namespace std; const int N=200006; int cur_id; namespace 阅读全文
posted @ 2019-12-24 20:55 EM-LGH 阅读(323) 评论(0) 推荐(0)
摘要:明明可以用二维数点来做啊,网上为什么都是树剖+线段树呢 ? code: #include <cstdio> #include <cstring> #include <algorithm> #define N 100006 #define inf 1000000 #define ll long lon 阅读全文
posted @ 2019-12-24 18:55 EM-LGH 阅读(215) 评论(0) 推荐(0)
摘要:这个题的思路非常好啊. 我们可以把 $k$ 个点拿出来,那么就是求将 $k$ 个点划分成不大于 $m$ 个集合的方案数. 令 $f[i][j]$ 表示将前 $i$ 个点划分到 $j$ 个集合中的方案数. 那么有 $f[i][j]=f[i-1][j-1]+f[i-1][j]*(j-fail[i])$, 阅读全文
posted @ 2019-12-24 13:37 EM-LGH 阅读(146) 评论(0) 推荐(0)
摘要:思路不难,但是细节还是挺多的,要格外注意一下. code: #include <cstdio> #include <queue> #include <cstring> #include <algorithm> #define N 2005 #define ll long long #define m 阅读全文
posted @ 2019-12-23 20:43 EM-LGH 阅读(200) 评论(0) 推荐(0)
摘要:code: #include <cstdio> #include <cstring> #include <algorithm> #define N 100020 #define ll long long #define setIO(s) freopen(s".in","r",stdin) using 阅读全文
posted @ 2019-12-23 18:49 EM-LGH 阅读(125) 评论(0) 推荐(0)
摘要:code: #include <cstdio> #include <algorithm> #define N 50020 #define ll long long #define setIO(s) freopen(s".in","r",stdin) using namespace std; stru 阅读全文
posted @ 2019-12-23 16:44 EM-LGH 阅读(130) 评论(0) 推荐(0)
摘要:你发现平均值不会很大,所以直接暴力枚举平均值,然后跑 4*100 次最小生成树取最小值即可. code: #include <cstdio> #include <cmath> #include <algorithm> #define N 2005 #define ll long long #defi 阅读全文
posted @ 2019-12-23 16:28 EM-LGH 阅读(154) 评论(0) 推荐(0)
摘要:非常好的一道思维题. code: #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #define lson x<<1 #define rson x<<1|1 #define N 500010 #d 阅读全文
posted @ 2019-12-23 15:43 EM-LGH 阅读(124) 评论(0) 推荐(0)
摘要:以前一直以为这道题很恶心,事实证明还好,好多地方脑残写丑了. code: #include <cstdio> #include <string> #include <cstring> #include <algorithm> #define N 50003 using namespace std; 阅读全文
posted @ 2019-12-21 16:00 EM-LGH 阅读(207) 评论(0) 推荐(0)
摘要:code: #include <string> #include <cstring> #include <cstdio> #include <algorithm> #define N 50003 #define lson now<<1 #define rson now<<1|1 #define in 阅读全文
posted @ 2019-12-21 09:33 EM-LGH 阅读(151) 评论(0) 推荐(0)
摘要:然而这只是 70pts 的部分分,考场上没想到满分怎么做(现在也不会) code: #include <cstdio> #include <string> #include <stack> #include <queue> #include <cstring> #include <algorithm 阅读全文
posted @ 2019-12-21 08:38 EM-LGH 阅读(199) 评论(0) 推荐(0)
摘要:求:$a^{bx \%p}\equiv 1(\mod p)$ 的一个可行的 $x$. 根据欧拉定理,我们知道 $a^{\phi(p)}\equiv 1(\mod p)$ 而在 $a^x\equiv 1(\mod p)$ 这个式子中 $x$ 是存在很多个解的. 这些解之间存在着循环节,使得任意解 $x 阅读全文
posted @ 2019-12-20 18:58 EM-LGH 阅读(267) 评论(0) 推荐(0)
摘要:题意:给定一颗树,有 $m$ 次操作. 操作 0 :向集合 $S$ 中加入一条路径 $(p,q)$,权值为 $v$ 操作 1 :给定一个点集 $T$,求 $T$ 的并集与 $S$ 中路径含交集的权和.(就是如果路径 $i$ 与 $T$ 有交集,就产生 $v_{i}$ 的贡献) 数据范围:路径长度 $ 阅读全文
posted @ 2019-12-20 17:56 EM-LGH 阅读(266) 评论(0) 推荐(0)
摘要:这个思路很巧妙啊 ~ code: #include <cstdio> #include <algorithm> #define N 2050 #define ll int #define setIO(s) freopen(s".in","r",stdin) using namespace std; 阅读全文
posted @ 2019-12-19 20:48 EM-LGH 阅读(159) 评论(0) 推荐(0)
摘要:好神啊 ~ 打表程序: #include <cstdio> #include <cstring> #include <algorithm> #define N 140000000 #define ll long long #define mod 998244353 #define setIO(s) 阅读全文
posted @ 2019-12-19 14:07 EM-LGH 阅读(136) 评论(0) 推荐(0)
摘要:判断有没有解:让所有没有障碍的格子都放一个士兵. 那么,题中要求最少放几个士兵,就是最多拿走几个士兵. 而由于行和列对士兵个数都是由要求的,这就规定了拿走的士兵的上界. 跑一个最大流来求就行了. code: #include <cstdio> #include <queue> #include <a 阅读全文
posted @ 2019-12-18 20:17 EM-LGH 阅读(169) 评论(0) 推荐(0)

上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 33 下一页