{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"题意:给定一张无向图,求其中权值最小的一座桥,派最少的士兵去炸掉它!!"}},{"title":"Input","value":{"format":"HTML","content":"There are no more than 12 test cases. \n\u003cbr\u003e \n\u003cbr\u003eIn each test case: \n\u003cbr\u003e \n\u003cbr\u003eThe first line contains two integers, N and M, meaning that there are N islands and M bridges. All the islands are numbered from 1 to N. ( 2 \u0026lt;\u003d N \u0026lt;\u003d 1000, 0 \u0026lt; M \u0026lt;\u003d N \n\u003csup\u003e2\u003c/sup\u003e ) \n\u003cbr\u003e \n\u003cbr\u003eNext M lines describes M bridges. Each line contains three integers U,V and W, meaning that there is a bridge connecting island U and island V, and there are W guards on that bridge. ( U ≠ V and 0 \u0026lt;\u003d W \u0026lt;\u003d 10,000 ) \n\u003cbr\u003e \n\u003cbr\u003eThe input ends with N \u003d 0 and M \u003d 0."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print the minimum soldier number Zhou Yu had to send to complete the mission. If Zhou Yu couldn\u0027t succeed any way, print -1 instead."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e3 3\n1 2 7\n2 3 4\n3 1 4\n3 2\n1 2 7\n2 3 4\n0 0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e-1\n4\u003c/pre\u003e"}}]}