| 2024-2025 ICPC, Swiss Subregional |
|---|
| Finished |
There have been reports of cheating in the ICPC (Interdisciplinary Course for Programming and Cooking) at ETH Zürich! After checking all submitted assignments, a list of cheating reports has been made.
Each report is a pair $$$(X, Y)$$$, meaning that the student with legi $$$X$$$ and the student with legi $$$Y$$$ shared some of their homework. For simplicity, we assume that legi are consecutively indexed, starting with $$$1$$$ (if there are $$$5$$$ students taking the course, they will have a legi of $$$1, 2, 3, 4$$$, and $$$5$$$).
The general consensus is that most ETH students follow the code of conduct, and the current hypothesis is that the students can be divided into 2 types:
Specifically, the hypothesis is that the set $$$V = \{ 1, 2, \dots, N \}$$$ of students can be partitioned into the sets $$$A$$$ and $$$B$$$ such that:
Your task is to verify if such a division of $$$V$$$ into $$$A$$$ and $$$B$$$ exists.
The first line contains the numbers $$$N$$$ ($$$1 \leq N \leq 10^5$$$) and $$$M$$$ ($$$0 \leq M \leq 10^6$$$), representing the number of students taking the course and the number of reports.
Each of the following $$$M$$$ lines contains two numbers $$$x_i$$$ and $$$y_i$$$ ($$$1 \leq x_i, y_i \leq N, x_i \neq y_i$$$), the $$$i$$$-th report.
For any two distinct reports, the corresponding pairs of students are distinct as well.
If a valid partition of the students satisfying the hypothesis exists, print YES. Otherwise, print NO.
4 41 22 33 44 1
NO
5 61 22 33 11 41 53 5
YES
| Name |
|---|


