#include using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define pb push_back #define pf push_front #define fi first #define se second #define BIT(x,n) bitset(x) #define PI 3.14159265358979323846 typedef long long ll; typedef pair P; typedef pair PP; //----------------------------------------------------------------------------- template< typename T > struct Kruskal { // Kruskalに必要なライブラリ開始。 struct Edge { int from,to; T cost; Edge(int to,T cost):from(-1),to(to),cost(cost) {} Edge(int from,int to,T cost):from(from),to(to),cost(cost) {} bool operator<(const Edge &e) const { return cost; struct UnionFind { vector data; UnionFind(int size):data(size,-1) {} bool unite(int x,int y) { x=root(x),y=root(y); if(x!=y) { if(data[y]>a>>b>>c; add_edge(a,b,c); } } bool kruskal(ll mid) { //cout<<"mid "<