摘要:
A题 模拟 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int mod1=1e9+7; const int mod2=1e9+9; int base=11; struct X{ int x,y; i 阅读全文
摘要:
将图的所有状态都存下来,一步一步bfs遍历,但是需要去重,由于重载运算符过于复杂,因此考虑用双哈希去重 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int mod1=1e9+7; const int 阅读全文
摘要:
观察到所有成环的之间的距离都是1,因此可以想到使用tarjan缩点后建立园方树 这样答案就是两点间距离/2 #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pll; const int N=1e6+10; int 阅读全文
摘要:
A 映射一下 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pll; const int N=4e5+10; const int inf=1e9; int a[N]; 阅读全文
摘要:
本题的k很小,我们发现最多不超过10的点会产生贡献 题目中要求没有奇数环,这让我们想到了二分图染色。 因此答案肯定是所有偶数环的最优解。 因此我们对图上的点随机赋值一种颜色,走所有的偶数环 在重复一定的数量,这样走到正解的概率就很大了 #include<bits/stdc++.h> using na 阅读全文