{"problem":{"name":"Unicyclic Components","description":{"content":"You are given an undirected graph with $N$ vertices numbered $1$ to $N$ and $M$ edges numbered $1$ to $M$. Edge $i$ connects vertex $u_i$ and vertex $v_i$. Determine whether every connected component ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc292_d"},"statements":[{"statement_type":"Markdown","content":"You are given an undirected graph with $N$ vertices numbered $1$ to $N$ and $M$ edges numbered $1$ to $M$. Edge $i$ connects vertex $u_i$ and vertex $v_i$.\nDetermine whether every connected component in this graph satisfies the following condition.\n\n*   The connected component has the same number of vertices and edges.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $0 \\leq M \\leq 2 \\times 10^5$\n*   $1 \\leq u_i \\leq v_i \\leq N$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$u_1$ $v_1$\n$\\vdots$\n$u_M$ $v_M$\n\n[samples]\n\n## Notes\n\nAn **undirected graph** is a graph with edges without direction.  \nA **subgraph** of a graph is a graph formed from a subset of vertices and edges of that graph.  \nA graph is **connected** when one can travel between every pair of vertices in the graph via edges.  \nA **connected component** is a connected subgraph that is not part of any larger connected subgraph.","is_translate":false,"language":"English"}],"meta":{"iden":"abc292_d","tags":[],"sample_group":[["3 3\n2 3\n1 1\n2 3","Yes\n\nThe graph has a connected component formed from just vertex $1$, and another formed from vertices $2$ and $3$.  \nThe former has one edge (edge $2$), and the latter has two edges (edges $1$ and $3$), satisfying the condition."],["5 5\n1 2\n2 3\n3 4\n3 5\n1 5","Yes"],["13 16\n7 9\n7 11\n3 8\n1 13\n11 11\n6 11\n8 13\n2 11\n3 3\n8 12\n9 11\n1 11\n5 13\n3 12\n6 9\n1 10","No"]],"created_at":"2026-03-03 11:01:14"}}