上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 60 下一页
摘要: 题目链接:https://atcoder.jp/contests/abc403/tasks/abc403_g 解题思路: 每个节点额外维护两个信息: sum[1]:这个节点所在子树中所有 dfs序为奇数的节点的权值和; sum[0]:这个节点所在子树中所有 dfs序为偶数的节点的权值和。 使用 FH 阅读全文
posted @ 2025-04-27 21:42 quanjun 阅读(57) 评论(0) 推荐(0)
摘要: 题目链接:https://atcoder.jp/contests/arc030/tasks/arc030_4 题目大意:vjudge链接 现有一个长度为 \(N\) 的数列 \(X={x_1,x_2,...,x_N}\)。需要对数列执行 \(Q\) 次查询操作。查询操作共有\(3\) 种类型,具体如 阅读全文
posted @ 2025-04-23 13:57 quanjun 阅读(43) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P3379 解题思路: 对一棵树进行 DFS,无论是第一次访问还是回溯,每次到达一个结点时都将编号记录下来,可以得到一个长度为 \(2n-1\) 的序列,这个序列被称作这棵树的欧拉序列。 在下文中,把结点 u 在欧拉序列中第 阅读全文
posted @ 2025-04-18 15:32 quanjun 阅读(75) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P1533 解题思路: 主席树求区间第k小模板题 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = 1e7 + 5; const int 阅读全文
posted @ 2025-04-17 18:14 quanjun 阅读(31) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P3466 解题思路完全来自 CodyTheWolf大佬的博客 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; mt 阅读全文
posted @ 2025-04-17 16:38 quanjun 阅读(25) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P2161 题目大意: 你需要维护一个在数轴上的线段的集合 \(S\),支持两种操作: A l r 表示将 \(S\) 中所有与线段 \([l,r]\) 相交的线段删去,并将 \([l,r]\) 加入 \(S\) 中。 B 阅读全文
posted @ 2025-04-15 18:34 quanjun 阅读(35) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P3871 解题思路: FHQ Treap模板题,只涉及插入和 kth 操作。 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = 2e5 阅读全文
posted @ 2025-04-15 18:16 quanjun 阅读(25) 评论(0) 推荐(0)
摘要: 题目链接:https://www.acwing.com/problem/content/2439/ 解题思路: 翻转,加懒惰标记 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; mt19937 阅读全文
posted @ 2025-04-15 14:27 quanjun 阅读(22) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P3369 FHQ Treap 示例程序: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; mt19937 rng(time(0 阅读全文
posted @ 2025-04-15 13:16 quanjun 阅读(35) 评论(0) 推荐(0)
摘要: 题目链接:https://atcoder.jp/contests/abc400/tasks/abc400_d 解题思路: 双端队列BFS(0-1 BFS)参考资料:https://oi.wiki/graph/bfs/#双端队列-bfs 比赛时我是用SPFA写的,然后TLE了一个点,然后用dijkst 阅读全文
posted @ 2025-04-05 22:31 quanjun 阅读(180) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 60 下一页