{"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":"You are given an unweighted graph. Check if the input is a tree.\nThe first line of the input file contains two integers \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eM\u003c/i\u003e -- the number of vertices and the number of edges (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 such that each line shows a pair (\u003ci\u003eu\u003c/i\u003e, \u003ci\u003ev\u003c/i\u003e) meaning that there is an undirected 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 \u003ch4\u003eOutput\u003c/h4\u003e \n \u003cp\u003e Print \u003ci\u003eYES\u003c/i\u003e if the given graph is a tree, otherwise print \u003ci\u003eNO\u003c/i\u003e. \u003c/p\u003e \n \u003ch4\u003eSample\u003c/h4\u003e \n \u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n0 0\n\u003cb\u003eOutput:\u003c/b\u003e\nNO\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\n \u003c/body\u003e\n\u003c/html\u003e"}}]}