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:
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
YESif the given graph is a simple graph, otherwise printNO. 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
Bình luận