摘要:struct Point { int id; LL x,y; Point(){} Point(LL x,LL y):x(x),y(y){} void Read(){scanf("%I64d%I64d",&x,&y);} LL operator^(const Point P)const{return x*P.y-y*P.x;} Point o...
阅读全文
posted @ 2016-07-23 19:44
|
|
|
07 2016 档案
摘要:struct Point { int id; LL x,y; Point(){} Point(LL x,LL y):x(x),y(y){} void Read(){scanf("%I64d%I64d",&x,&y);} LL operator^(const Point P)const{return x*P.y-y*P.x;} Point o...
阅读全文
posted @ 2016-07-23 19:44
摘要:今天做 Codeforces 687D 突然发现并查集学得很屎。 问题是给你两个二部图的连通分量,用并查集表示,其中每个联通分量都有一个根。每个点有一个rela[i]代表这个点的颜色与根相同还是不同。 问如何将这两个集合合并,并维护rela。 想法很简单,判断添加边的两个点原先跟他们根的关系,若相同
阅读全文
posted @ 2016-07-13 18:22
|
|