05 2025 档案

摘要://https://www.luogu.com.cn/problem/P10935 //https://www.acwing.com/problem/content/description/370/ #include <bits/stdc++.h> using namespace std; cons 阅读全文
posted @ 2025-05-11 10:56 九三青梧 阅读(10) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P2680 #include <bits/stdc++.h> #pragma G++ optimize(3) #pragma G++ target("avx") #pragma G++ optimize("Ofast") #pra 阅读全文
posted @ 2025-05-10 12:11 九三青梧 阅读(9) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P11967 #include <bits/stdc++.h> using namespace std; const int N=1e6+10,M=N*2; int e[M],ne[M],h[N],idx; int depth[N 阅读全文
posted @ 2025-05-10 10:42 九三青梧 阅读(20) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P3128 #include <bits/stdc++.h> using namespace std; const int N=5e4+10,M=N*2; int e[M],ne[M],h[N],idx; int depth[N] 阅读全文
posted @ 2025-05-10 10:17 九三青梧 阅读(9) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P3398 #include <bits/stdc++.h> using namespace std; const int N=1e5+10,M=N*2; int e[M],ne[M],h[N],idx; int depth[N] 阅读全文
posted @ 2025-05-05 12:12 九三青梧 阅读(10) 评论(0) 推荐(0)
摘要://https://www.acwing.com/problem/content/description/354/ #include <bits/stdc++.h> using namespace std; const int N=1e5+10,M=2*N; int e[M],ne[M],h[N], 阅读全文
posted @ 2025-05-05 12:02 九三青梧 阅读(6) 评论(0) 推荐(0)
摘要:题目解析 本题要求在给定的树结构和一个节点访问序列中,对于每个节点,计算跳过该节点后的路径总长度。关键在于高效计算树上任意两点间距离,并利用预处理优化计算过程。 方法思路 树结构预处理 DFS 计算节点到根的距离:通过遍历树,记录每个节点到根节点的距离,存储于 dist 数组。 倍增法预处理 LCA 阅读全文
posted @ 2025-05-05 11:04 九三青梧 阅读(29) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P3379 #include <bits/stdc++.h> using namespace std; const int N=5e5+10,Q=5e5+10,M=2*N; typedef pair<int,int> pii; i 阅读全文
posted @ 2025-05-04 10:23 九三青梧 阅读(12) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P3379 #include <bits/stdc++.h> using namespace std; const int N=5e5+10,M=N*2; int e[M],ne[M],h[N],idx; int depth[N] 阅读全文
posted @ 2025-05-04 09:58 九三青梧 阅读(6) 评论(0) 推荐(0)
摘要://https://www.acwing.com/problem/content/1173/ //http://ybt.ssoier.cn:8088/problem_show.php?pid=1556 #include <bits/stdc++.h> using namespace std; con 阅读全文
posted @ 2025-05-04 09:40 九三青梧 阅读(11) 评论(0) 推荐(0)
摘要://https://www.acwing.com/problem/content/1174 //http://ybt.ssoier.cn:8088/problem_show.php?pid=1557 #include <bits/stdc++.h> using namespace std; cons 阅读全文
posted @ 2025-05-04 09:05 九三青梧 阅读(15) 评论(0) 推荐(0)
摘要://https://leetcode.cn/problems/Jf1JuT/ const int N=26,M=110; class Solution { private: int head[N],Next[M],to[M],cnt; int indegree[N]; int h,t; int q[ 阅读全文
posted @ 2025-05-01 18:25 九三青梧 阅读(5) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/U107394 #include <bits/stdc++.h> using namespace std; const int N=1e5+10,M=N; int n,m; int head[N],Next[M],to[M],cn 阅读全文
posted @ 2025-05-01 17:57 九三青梧 阅读(10) 评论(0) 推荐(0)
摘要://https://leetcode.cn/problems/course-schedule-ii/ const int N=2e3+10,M=N*(N-1); class Solution { private: int n,m; int head[N],Next[M],to[M],cnt; int 阅读全文
posted @ 2025-05-01 17:40 九三青梧 阅读(8) 评论(0) 推荐(0)
摘要://https://www.nowcoder.com/practice/88f7e156ca7d43a1a535f619cd3f495c #include <bits/stdc++.h> using namespace std; const int N=2e5+10,M=N; int n,m; in 阅读全文
posted @ 2025-05-01 17:29 九三青梧 阅读(5) 评论(0) 推荐(0)
摘要://https://www.luogu.com.cn/problem/P4926 #include <bits/stdc++.h> using namespace std; const int N=1e3+10,M=3*N; int vow[N][4],score[N][2]; int head[N 阅读全文
posted @ 2025-05-01 12:30 九三青梧 阅读(16) 评论(0) 推荐(0)