All submissions for this problem are available.
Given a conneted graph (V,E). You have to find out whether minimum spanning tree of graph is unique or not.
A spanning tree T of a connected, undirected graph G is a tree composed of all the vertices and some (or perhaps all) of the edges of G. Minimum spanning tree (MST) or Minimum weight spanning tree is a spanning tree with weight less than or equal to the weight of every other spanning tree.
The first line of input contains a single integer t, number of test cases. Then t test cases follows. Each test case specifies a graph. First line of each test case contains two integers n and m (1 <= n <= 100), the number of nodes and edges respectively. Each of the following m lines contains three integers x,y,z indicating that there is edge joining vertex x and y of weight z. There will be atmost one edge between pair of vertices.
For each input, if the MST is unique, print "Unique", or otherwise print the string "Not Unique"
3 4 3
4 2 3
2 1 3
1 3 3
|Time Limit:||0.142857 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.