ICPC
csx_zzh
这个作者很懒,什么都没留下…
展开
-
后缀自动机
int last,num; struct node{ int fa,len,sum; int son[26]; }t[maxn*2]; void extend(int c){ //每次向SAM中插入一个元素c p=last,np=++num; t[np].len=t[p].len+1;np=num;cc[np]=1; while(p&&!t[p].son[c])t[p].son[c]=np,p=t[p].fa; if(!p)t[转载 2021-05-10 08:57:42 · 184 阅读 · 0 评论 -
异或前缀和+map维护
给出n和n个数,求异或和为0的子段个数 设a[i]为输入的数 b[i]为异或前缀和 b[i] = a[1] ^ a[2] ^ … ^ a[i - 1] ^ a[i] 已知一个数x^y = 0当且仅当x == y时成立 那么对于一段[1,r]来说,异或前缀和为b[r],那么如果想要以r为异或为0的子段的右半部分,那么只需要前面出现过一个数b[i] == b[r],那么[i + 1,r]这一段异或和为0 就比如 对于x1,x2,x3…xr,如果想要找到一段区间[i,r]使得其区间异或和为0,设x1,x2,x3…转载 2021-05-03 21:32:19 · 162 阅读 · 0 评论 -
字符串完全总结
///https://blog.csdn.net/weixin_43093481/article/details/82318377 目录 1.常用STL方法 任意进制转换: itoa(int n,char* s,int r) //将10进制n转换为r进制并赋给s 类型转换: string ->int : string s("123"); int i = atoi(s.c_str()); int ->转载 2021-04-29 19:06:03 · 62 阅读 · 0 评论 -
ACM ICPC
基础数据结构 set find() #include<iostream> #include<set> using namespace std; int main() { set<int> st; for(int i=0;i<=3;i++) st.insert(i); set<int>::iterator it=st.find(2); cout<<*it; }原创 2021-04-28 20:17:23 · 128 阅读 · 0 评论