摘要:
平衡树 treap模板 #include<bits/stdc++.h> using namespace std; const int N = 1e5+10,INF = 0x3f3f3f3f; int idx; struct NODE{ int l,r; int key,val; int cnt,si 阅读全文
摘要:
求以1为根的生成树各个节点与根距离之和的最小值,各个节点与根的距离最小值可以用dij求出 保留的边的数量一定是n-1条 #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL,int> PL 阅读全文
摘要:
找出三元组i,j,k(i<j<k,ai,aj,ak互不相等) 等价于找出ai,aj,ak(ai<aj<ak,i,j,k互不相等) #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 2e5+ 阅读全文
摘要:
树状数组+二分 sum(x)返回x之前有多少个点已经被取走了,a[i]+1为左边界,n为右边界,判断sum(x)和(x-1-a[i])大小即可 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N 阅读全文
摘要:
带权并查集,d[x]维护x到父节点的距离 #include<bits/stdc++.h> using namespace std; const int N = 1e5+10; int fa[N],d[N]; int find(int x){ if(x!=fa[x]){ int t=find(fa[x 阅读全文
摘要:
对于第i(1<=i<=n)列为最终状态,分为3种情况 f[0][i]表示这列的没有'*' f[1][i]表示这列有且仅有第一行有'*' f[2][i]表示这列有且仅有第二行有'*' #include<bits/stdc++.h> using namespace std; const int N = 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; const int N = 110; const double eps = 1e-8; int n; double a[N][N]; int gauss(){ int r,c; for(r=0,c=0;c<n; 阅读全文