{"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 HSTU. He saw various trees at HSTU 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 topology. \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 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\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\n3 2\n1 2\n2 3\n\n\u003cb\u003eOutput:\u003c/b\u003e\nYES\n\u003c/pre\u003e \n\u003c/div\u003e"}}]}