are given an undirected complete diagram with n hubs, where a few edges are pre-appointed with a positive weight while the rest aren't. You wanted to allot all unassigned edges with non-negative loads so that in the subsequent completely appointed total chart the XOR amount, all things considered, would be equivalent to 0.
Correct answer will be upvoted else downvoted. Computer science.
You are given an undirected complete diagram with n hubs, where a few edges are pre-appointed with a positive weight while the rest aren't. You wanted to allot all unassigned edges with non-negative loads so that in the subsequent completely appointed total chart the XOR amount, all things considered, would be equivalent to 0.
Characterize the offensiveness of a completely alloted complete chart the heaviness of its base spreading over tree, where the heaviness of a crossing tree approaches the amount of loads of its edges. You really wanted to appoint the loads with the goal that the offensiveness of the subsequent chart is just about as little as could be expected.
As an update, an undirected complete diagram with n hubs contains all edges (u,v) with 1≤u<v≤n; such a chart has n(n−1)2 edges.
She isn't sure how to take care of this issue, so she requests that you address it for her.
Input
The principal line contains two integers n and m (2≤n≤2⋅105, 0≤m≤min(2⋅105,n(n−1)2−1)) — the number of hubs and the number of pre-appointed edges. The inputs are given so that there is something like one unassigned edge.
The I-th of the accompanying m lines contains three integers ui, vi, and wi (1≤ui,vi≤n, u≠v, 1≤wi<230), addressing the edge from ui to vi has been pre-allocated with the weight wi. No edge shows up in the input more than once.
Output
Print on one line one integer — the base offensiveness among all weight tasks with XOR total equivalent to 0.

Step by step
Solved in 4 steps with 1 images









