{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \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: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n \u003cp\u003e王德发最近开始学习图论,老师给了他一个无向图,王德发想知道这副图是不是一颗树,你能帮帮他吗.\u003c/p\u003e\n \u003ch3\u003eInput\u003c/h3\u003e\n \u003cp\u003eThe first line of the input file contains two integers \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eM\u003c/i\u003e --- number of nodes and number of edges in the graph (0 \u0026lt; \u003ci\u003eN\u003c/i\u003e \u0026lt;\u003d 10000, 0 \u0026lt;\u003d \u003ci\u003eM\u003c/i\u003e \u0026lt;\u003d 20000). Next \u003ci\u003eM\u003c/i\u003e lines contain \u003ci\u003eM\u003c/i\u003e edges of that graph --- Each line contains a pair (\u003ci\u003eu\u003c/i\u003e, \u003ci\u003ev\u003c/i\u003e) means there is an edge between node \u003ci\u003eu\u003c/i\u003e and node \u003ci\u003ev\u003c/i\u003e (1 \u0026lt;\u003d \u003ci\u003eu\u003c/i\u003e,\u003ci\u003ev\u003c/i\u003e \u0026lt;\u003d \u003ci\u003eN\u003c/i\u003e).\u003c/p\u003e\n \u003ch3\u003eOutput\u003c/h3\u003e\n \u003cp\u003ePrint \u003ci\u003eYES\u003c/i\u003e if the given graph is a tree, otherwise print \u003ci\u003eNO\u003c/i\u003e.\u003c/p\u003e\n \u003ch3\u003eExample\u003c/h3\u003e\n \u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n3 2\n1 2\n2 3\n\n\u003cb\u003eOutput:\u003c/b\u003e\nYES\n\u003c/pre\u003e\n\u003c/div\u003e"}}]}