摘要: 面对形如\(f_j \cdot g_{j-i}\)的“差卷积”,可以通过倒置数组的方法凑出卷积的形式 #include <bits/stdc++.h> #define int long long using namespace std; const signed mod=1004535809; in 阅读全文
posted @ 2025-05-03 11:13 D06 阅读(2) 评论(0) 推荐(0)
摘要: 预处理质数表的质因数分解时间复杂度为\(O(\frac {\sqrt n}{\ln n})\) Pollard rho则用于在\(O(n^{1/4})\)的期望时间复杂度内计算合数\(n\)的某个非平凡因子 #include <bits/stdc++.h> #define int long long 阅读全文
posted @ 2025-05-02 19:32 D06 阅读(11) 评论(0) 推荐(0)
摘要: 推理类问题,一定要注意排除法的应用,即推到最后剩下来的对象一定符合题意,不需要再付出代价去验证 如果由单个点构成的强连通分量满足把它删除后入度为0的强连通分量不增加,答案就可以+1 #include <bits/stdc++.h> #define int long long using namesp 阅读全文
posted @ 2025-05-02 14:19 D06 阅读(3) 评论(0) 推荐(0)
摘要: 返回范围 [first, last) 中满足特定判别标准的元素数: std::count 计数等于 value 的元素(使用 operator==) std::count_if 计数谓词 p 对其返回 true 的元素 例如: cout << (count(a, a + 9, t) ? "weak\ 阅读全文
posted @ 2025-04-30 08:19 D06 阅读(5) 评论(0) 推荐(0)
摘要: std::tie 可以用于结构化绑定 exgcd返回的\(x \in [-b,b]\),\(y \in [-a,a]\) #include <bits/stdc++.h> #define int long long using namespace std; typedef pair<int,int> 阅读全文
posted @ 2025-04-30 08:19 D06 阅读(1) 评论(0) 推荐(0)
摘要: C 有 \(n\) 个点,初始时均为孤立点。 接下来有 \(m\) 次加边操作,第 \(i\) 次操作在 \(a_i\) 和 \(b_i\) 之间加一条无向边。 接下来有 \(q\) 次询问,第 \(i\) 次询问第 \(x_i\) 个点在第 \(t_i\) 次操作后所在连通块的大小。 Kruska 阅读全文
posted @ 2025-04-29 08:59 D06 阅读(5) 评论(0) 推荐(0)
摘要: A. Vadim's Collection #include <bits/stdc++.h> #define int long long using namespace std; int cnt[10]; signed main() { ios::sync_with_stdio(false); ci 阅读全文
posted @ 2025-04-27 10:59 D06 阅读(42) 评论(0) 推荐(0)
摘要: 木柜子组乐队 #include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int T; cin>>T; whi 阅读全文
posted @ 2025-04-26 15:41 D06 阅读(15) 评论(0) 推荐(0)
摘要: 扫地机器人 首先DP预处理,然后把环单“拎”出来,分类讨论顺逆时针两类情况,用前缀和拆分起点和终点,对每一个起点取最大的一项作为终点与最优解比较即可 赛场上没注意到是每条边只能经过一次,所以漏掉了一类“领带”形状的解,唉…😮‍💨 阅读全文
posted @ 2025-04-16 08:57 D06 阅读(5) 评论(0) 推荐(0)
摘要: 小凯逛超市 #include <bits/stdc++.h> #define int long long using namespace std; const int mod=1000000007; int f[405][405]; signed main() { ios::sync_with_st 阅读全文
posted @ 2025-04-15 14:31 D06 阅读(33) 评论(0) 推荐(0)
//雪花飘落效果