简单并查集
文章平均质量分 51
_Griffith
每天都要学习新知识
展开
-
简单并查基
#include using namespace std;int f[1001];int n,m;int getf(int x){ int r = x; while(r != f[r]) r = f[r];///找到大boss int i = x,j; while(f[i]!= r)///压缩原创 2017-07-17 12:00:38 · 204 阅读 · 0 评论 -
Vessels CodeForces - 371D
A - Vessels CodeForces - 371D 题意:进行两种操作:1代表向x容器中倒入y升水2代表 查询x容器中 的水为多少将所有容器从下往上开始标号 1到 n,当要倒水的时候,只需要找到当前容器的祖先,所谓祖先就是最上面有水的容器,在往上就没有了#include #include #include #include原创 2017-07-23 13:31:51 · 220 阅读 · 0 评论