{"trustable":true,"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":"\u003cdiv class\u003d\"panel_content\"\u003eTo see a World in a Grain of Sand \u003cbr\u003eAnd a Heaven in a Wild Flower, \u003cbr\u003eHold Infinity in the palm of your hand \u003cbr\u003eAnd Eternity in an hour. \u003cbr\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;—— William Blake\u003cbr\u003e\u003cbr\u003e听说lcy帮大家预定了新马泰7日游,Wiskey真是高兴的夜不能寐啊,他想着得快点把这消息告诉大家,虽然他手上有所有人的联系方式,但是一个一个联系过去实在太耗时间和电话费了。他知道其他人也有一些别人的联系方式,这样他可以通知其他人,再让其他人帮忙通知一下别人。你能帮Wiskey计算出至少要通知多少人,至少得花多少电话费就能让所有人都被通知到吗?\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"多组测试数组,以EOF结束。\u003cbr\u003e第一行两个整数N和M(1\u0026lt;\u003dN\u0026lt;\u003d1000, 1\u0026lt;\u003dM\u0026lt;\u003d2000),表示人数和联系对数。\u003cbr\u003e接下一行有N个整数,表示Wiskey联系第i个人的电话费用。\u003cbr\u003e接着有M行,每行有两个整数X,Y,表示X能联系到Y,但是不表示Y也能联系X。\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"输出最小联系人数和最小花费。\u003cbr\u003e每个CASE输出答案一行。\u003cbr\u003e"}},{"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\u003e\u003cpre\u003e12 16\r\n2 2 2 2 2 2 2 2 2 2 2 2 \r\n1 3\r\n3 2\r\n2 1\r\n3 4\r\n2 4\r\n3 5\r\n5 4\r\n4 6\r\n6 4\r\n7 4\r\n7 12\r\n7 8\r\n8 7\r\n8 9\r\n10 9\r\n11 10\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 6\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}