{"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":"\u003cscript\u003e\n\tsetTimeout(function(){\n\t\trenderMathInElement(document.body, {delimiters: [{left: \u0027$$\u0027, right: \u0027$$\u0027, display: true}, {left: \u0027$\u0027, right: \u0027$\u0027, display: false}, {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false}]});\n\t}, 1000);\n\u003c/script\u003e\n\u003cdiv id\u003d\"problem-body\"\u003e \n \u003cp\u003eTop rated coder Tourist once decided to visit FEC. He saw various trees at FEC campus. But he wants to test your programming skill. You are given an unweighted, undirected graph. Write a program to check if it\u0027s a tree. \u003c/p\u003e \n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cp\u003e The first line of the input file contains two integers \u003ci\u003eN\u003c/i\u003e (0 \u0026lt; \u003ci\u003eN\u003c/i\u003e \u0026lt;\u003d 10000) and \u003ci\u003eE\u003c/i\u003e (0 \u0026lt;\u003d \u003ci\u003eE\u003c/i\u003e \u0026lt;\u003d 20000), number of nodes and number of edges in the graph. \u003cbr\u003e Next \u003ci\u003eE\u003c/i\u003e lines contain \u003ci\u003eE\u003c/i\u003e edges of that graph. In each line there is two integers (\u003ci\u003eu\u003c/i\u003e, \u003ci\u003ev\u003c/i\u003e) meaning 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\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 \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n4 3\n1 2\n2 3\n4 3\n\n\u003cb\u003eOutput:\u003c/b\u003e\nYES\n\n\u003cb\u003eInput:\u003c/b\u003e\n4 4\n1 2\n2 3\n3 4\n1 4\n\n\u003cb\u003eOutput:\u003c/b\u003e\nNO\n\u003c/pre\u003e \n\u003c/div\u003e"}}]}