- 博客(5)
- 收藏
- 关注
原创 Codeforces[1355E] Restorer Distance 【三分】
Description You have to restore the wall. The wall consists ofN pillars of bricks, the height of theii-th pillar is initially equal tohihi, the height is measured in number of bricks. After the restoration all theN pillars should have equal heights....
2020-05-27 16:53:05 286
原创 【模板】线段树
/* 线段树(Segment Tree) */ struct SegmentTree { static const int N=1e5+5; struct node{ int l,r; //[l,r]表示节点所代表的区间范围 int sum; //sum维护该区间内的元素和 int tag; //延迟标记 }; node t[N<<2]; void pushup(int p){ //区.
2020-05-23 21:51:13 126
原创 【模板】并查集
/* 并查集(DisjointSet) */ struct DisjointSet { const static int N=1e5+5; int fa[N],sum[N]; int find(int x){ if(fa[x]==x) return x; int root=find(fa[x]); sum[x]+=sum[fa[x]]; //路径压缩过程中,组内元素个数的更新 return fa[x].
2020-05-23 17:28:13 179
原创 【模板】Manacher
/* Manacher(最长回文子串) */ struct Manacher { static const int N=1e5+5; int len[N<<1];//以每位为中心的最长回文串的长度 char s[N],tmp[N<<1]; //初始化 int init(){ int n=strlen(s); tmp[0]='@'; for(int i=1;i<=2*n;i+=2){ .
2020-05-23 17:18:25 123
原创 【模板】树状数组
/* 树状数组(Binary Index Tree) */ struct BIT { static const int N=1e5+5; int t[N]; //查询前缀和 int query(int x){ int ans=0; for(;x;x-=(x&-x)) ans+=t[x]; return ans; } //单点修改 void add(int x,int y){ .
2020-05-23 11:26:51 144
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人