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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.