{"trustable":false,"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":"You are given an undirected weighted connected graph where each edge is black or white. Find a minimum weight spanning tree with exactly $k$ white edges.\nThe problem is guaranteed to be solvable. \n"}},{"title":"Input","value":{"format":"HTML","content":"The first line has $V$, $E$, and $k$, which respectively indicate the number of vertices, the number of edges and the number of white edges required.\n\u003cbr\u003e\u003cbr\u003e\nEach of the next $E$ lines, have $s$, $t$, $w$ and $c$ representing an edge with endpoints $s$ and $t$ with edge weight $w$ and edge color $c$ (0 white,1 black). \n\u003cbr\u003e\n\u003cbr\u003e\nV\u003c\u003d50000, E\u003c\u003d100000, all data edge weights are positive integers in [1,100]. \n"}},{"title":"Output","value":{"format":"HTML","content":"\n One line represents the sum of edge weights of the desired spanning tree. \n"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e2 2 1\n\u003cbr\u003e 0 1 1 1\n\u003cbr\u003e 0 1 2 0\n\u003c/td\u003e\n \u003ctd\u003e2\n\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":""}}]}