上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: 把询问全部放到树上,离线dfs处理 点击查看代码 #include <bits/stdc++.h> using namespace std; string s; int t[100005][26],tot,cnt,r[100005],fa[100005],fail[100005],dfn[10000 阅读全文
posted @ 2024-02-02 15:18 D06 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 自豪的是D题做出来了,悲哀的是B题没能做出来 C题的绝对值最小 D题,DP存不下状态就把状态放进所求值中 比赛快结束的时候,我想,这个B题,它但凡需要我通过归并排序或者树状数组求逆序对,不比C题进制转化要难?于是我就猜了一个结论 结论是对的,但不幸的是,我编程实现的时候出错了 考虑怎样证明这个结论, 阅读全文
posted @ 2024-02-01 21:18 D06 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 本想尝试一下朴素算法能得多少分,没想到直接过了……亲手构造了n=80000的全a数据,确定程序的复杂度的确是错的 考虑通过KMP算法构建的“失配树”,大概可以用双向链表维护前驱后继 点击查看代码 #include <bits/stdc++.h> using namespace std; int ne 阅读全文
posted @ 2024-02-01 17:14 D06 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 听说还可以用AC自动机做,字符集比较大的话,用map就可以了 点击查看代码 #include <bits/stdc++.h> using namespace std; int ha[50005],res[100005],ans[100005]; int s[500005],id[500005],to 阅读全文
posted @ 2024-02-01 16:09 D06 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 核心思想:对询问分块 适用条件:序列上的区间询问问题,O(1)扩展 关键 1.设定块长度 2.转移时,先扩大区间,再缩小区间 阅读全文
posted @ 2024-02-01 14:19 D06 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 在变化中寻找不变的量 通过差分转化为字符串匹配问题 通过打标记区分来自同一个字符串的不同子串 二分答案转化为判定 点击查看代码 #include <bits/stdc++.h> using namespace std; int m[1005],a[105],c[105],s[200005],ha[1 阅读全文
posted @ 2024-01-31 14:08 D06 阅读(3) 评论(0) 推荐(0) 编辑
摘要: \(\sum d_i <=5*10^7\)一定是解题的突破口;可是,该怎么利用这个条件呢? 不妨更进一步——考虑数据的特征,发现数字的种类是有限的 点击查看代码 #include <bits/stdc++.h> using namespace std; int d[2000005],r[200000 阅读全文
posted @ 2024-01-30 21:52 D06 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 容斥原理 将两个字符串拼接起来(中间用‘#’分隔开),再减去它们内部的贡献 height数组支持的最长公共前缀:不仅是长度,也是子串的个数 返回值开long long 核心代码与[AHOI2013] 差异 一致 点击查看代码 #include <bits/stdc++.h> using namesp 阅读全文
posted @ 2024-01-30 17:53 D06 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 #include <bits/stdc++.h> using namespace std; int sa[500005]; int rk[20][500005],w,p[25],r[500005],h[500005]; stack<int>s1; stack<int>s2; long 阅读全文
posted @ 2024-01-30 17:15 D06 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 似乎有O(n)的做法,但我想到的是用树状数组维护 注意树状数组维护的值域范围为1~n,(如果需要维护)0要特判 点击查看代码 #include <bits/stdc++.h> using namespace std; const int mod=1000000007; int ne[1000005] 阅读全文
posted @ 2024-01-30 15:02 D06 阅读(2) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页