摘要: 概率算法 每次随机取两个数,有四分之一的概率两个数都在答案中 但我赛后想到并在代码中实现的算法并不是这样的…… 对了,取模真的、真的非常慢 点击查看代码 #include <bits/stdc++.h> using namespace std; int h[1000005]; int a[5005] 阅读全文
posted @ 2024-01-22 21:09 D06 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 链式前向星存图 点击查看代码 #include <bits/stdc++.h> using namespace std; int h[100005],nx[100005],t[100005],cnt; int ans[100005]; int read1() { char cc=getchar(); 阅读全文
posted @ 2024-01-22 17:04 D06 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 基环树上的环形DP 两次DP,一次断开,一次强制连接 点击查看代码 #include <bits/stdc++.h> using namespace std; vector<int>z[500005]; int n,m,c[1000005]; bool b[2000005],v[1000005]; 阅读全文
posted @ 2024-01-22 15:05 D06 阅读(4) 评论(0) 推荐(0) 编辑