Processing math: 100%
Minimum spanning tree 2 - MarisaOJ: Marisa Online Judge

Minimum spanning tree 2

Time limit: 1000 ms
Memory limit: 256 MB
Given a connected, weighted, undirected graph of n vertices and m edges. For every edge, determine if it belongs to at least one minimum spanning tree. ### Input - The first line contain 2 integers n,m. - The next m lines, each line contains 3 integers u,v,w, there is an edge weigh w between u and v. ### Output - Print a binary string of length m. If ith edge belongs to at least one minimum spanning tree, the ith character should be 1, otherwise 0. ### Constraints - 1≤n,m≤105. - 1≤u,v≤n. - 1≤w≤109 ### Example Input: 47122232411325144121423 Output: 0110010