#include #include #include using namespace std; const int MaxN = 300+5; const int MaxM = 1e4+5; int Sum = 0; int ansMax = -1e6; struct _Edge{ int u; int v; int c; }Edge[MaxM]; template struct _Union{ const int maxN=MaxM; T f[MaxM]; _Union(){ for (T i=0; i Union; int main(){ int n,m; cin>>n>>m; for (int i=1; i<=m; i++) { cin>>Edge[i].u>>Edge[i].v>>Edge[i].c; } sort(Edge+1,Edge+1+m,[](_Edge a,_Edge b){return a.c