摘要: 打一波数据结构的板子PS:既然都有线段树了为什么还要树状数组?因为它快啊~~跑不满log,可以有效防止卡常数但是太复杂的操作就不要用它了(其实区间修改区间查询也能用,只是操作太高深了,不如直接线段树,差不了太多)... 阅读全文
posted @ 2018-07-20 09:06 Richardluan 阅读(4) 评论(0) 推荐(0)
摘要: 模板,,#include#include#include#include using namespace std;int t;int n;int fa[10005][20];int fst[10005];int ... 阅读全文
posted @ 2018-07-20 08:59 Richardluan 阅读(2) 评论(0) 推荐(0)
摘要: 板子~~~Floydfor(int k=1;k#includeusing namespace std;int n,m,s;int fst[10005];int nxt[500005];int v[500005];... 阅读全文
posted @ 2018-07-20 08:54 Richardluan 阅读(2) 评论(0) 推荐(0)
摘要: 我都觉得水《《》》#include#includeusing namespace std;struct poi{ int a[1000005]; int size; inline void pushup(int ... 阅读全文
posted @ 2018-07-19 16:19 Richardluan 阅读(3) 评论(0) 推荐(0)
摘要: 模板prim#include#includeusing namespace std;int m,n;int fst[5005];int nxt[400005];int v[400005];int k[400005... 阅读全文
posted @ 2018-07-19 14:31 Richardluan 阅读(2) 评论(0) 推荐(0)
摘要: 板子一波!~~线性筛素数#include#includeusing namespace std;bool a[60000005];int pre[3600000];int o=0;int n;int main()... 阅读全文
posted @ 2018-07-19 09:30 Richardluan 阅读(3) 评论(0) 推荐(0)
摘要: 模板。。不过还是讲一下题目描述求关于x的同余方程 ax≡1(mod)b的最小正整数解。我们可以把这个方程转化一下,变成 ax+by=1因为 题目保证有解,所以a,b互质裸的exgcdAC Code#include... 阅读全文
posted @ 2018-07-19 09:13 Richardluan 阅读(3) 评论(0) 推荐(0)
摘要: 存档。递归#include#includeusing namespace std;long long n,m,p;long long dfs(long long m){ if(m==1)return n; if(... 阅读全文
posted @ 2018-07-19 08:58 Richardluan 阅读(5) 评论(0) 推荐(0)
摘要: 传送门维护到根节点的和,判断即可初始化要到0。。。坑死我了AC Code#include#include#includeusing namespace std;int w;int n,m;int fa[1005]... 阅读全文
posted @ 2018-07-13 10:29 Richardluan 阅读(0) 评论(0) 推荐(0)
摘要: 传送门怎么也没想到是二分图。。。我们首先考虑,交换行或列并不会改变当前行或列黑格的数目,这也就说明了,在同一条直线上的黑格永远不会不在同一条直线。而我们要一条对角线,就相当于找一组黑格,满足没有任何格子在同一条直... 阅读全文
posted @ 2018-07-13 09:04 Richardluan 阅读(1) 评论(0) 推荐(0)