EISPGRH - Question 1

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

You are given an undirected graph that has ~n~ vertices and ~m~ edges. You should check if the given graph is a simple graph.

Input

  • The first line contains two integers ~n, m~ ~(0 < n, m ≤ 10^5)~.
  • Each of the next ~m~ lines contains two integers ~a, b~ representing an edge that connects vertex ~a~ and vertex ~b~ ~(0 ≤ a, b < n)~.

Output

  • Print YES if the given graph is a simple graph, otherwise print NO. The output is case-sensitive.

Sample Input 1

5 4
0 0
0 1
1 2
2 1

Sample Output 1

NO

Sample Input 2

5 4
0 1
1 2
2 3
0 3

Sample Output 2

YES

Notes


Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.