摘要:
本题容易看出分层的样子 对于i-1来更新i的答案。我们对于更新有两种选择,一种是直接枚举点对更新,一种是用spfa进行o(N*M)更新 我们发现对于两种情况的最坏复杂度情况不同,因此可以进行讨论选择使用哪一种更新、 #include<bits/stdc++.h> using namespace st 阅读全文
摘要:
显然质数越小越好,越小的质数次方越大越好,写个dfs爆搜一下 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int N=4e5+10; const int inf=0x3f3f3f3 阅读全文
摘要:
A 数位dp B 欧拉路径判定 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pll; const int N=500005; const int inf=0x3f3f 阅读全文
摘要:
对于本题,本质上是哈密顿回路,但是由于特殊性,每个点仅有一条往外的连边 因此,本题等价于欧拉路径的判断,只需要根据欧拉路径判断答案即可 即连通性和出度入度间的关系 #include<bits/stdc++.h> using namespace std; typedef long long ll; t 阅读全文