{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003edd \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background-color: #f5f5f5;\n border: 1px solid #ccc;\n border-radius: 4px;\n}\u003c/style\u003e","sections":[{"title":"Description","value":{"format":"HTML","content":"\u003cdiv\u003eGiven an undirected weighted connected graph, where each edge is either black or white. You are asked to find a minimum weight spanning tree with exactly need white edges.\u003c/div\u003e\n\u003cdiv\u003eThe problem guarantees a solution.\u003c/div\u003e\n\u003cp\u003e\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003eThe first line contains V, E, and need, representing the number of vertices, number of edges, and the required number of white edges, respectively.\u003c/div\u003e\n\u003cdiv\u003eFollowing are E lines, each line contains s, t, c, col representing the endpoints of the edge (vertices are 0-indexed), the edge weight, and the color (0 for white, 1 for black).\u003c/div\u003e\n\u003cp\u003e\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003eOutput a single line representing the total weight of the required spanning tree.\u003c/div\u003e\n\u003cdiv\u003eV\u0026lt;\u003d50000, E\u0026lt;\u003d100000, and all edge weights are positive integers in the range [1, 100].\u003c/div\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp\u003e\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 2 1\r\n0 1 1 1\r\n0 1 2 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e\u003cfont size\u003d\"3\"\u003eOriginal data error, now updated by\u0026nbsp;\u003c/font\u003e\u003cspan style\u003d\"font-family: Helvetica, \u0027Microsoft Yahei\u0027, verdana; font-size: 14px; line-height: 15.549334526062px;\"\u003eliutian\u003c/span\u003e\u003cspan style\u003d\"font-size: medium;\"\u003e, but not retested---2016.6.24\u003c/span\u003e\u003c/p\u003e"}}]}