Logo
(追記) (追記ここまで)

6790번 - Spies Like Us 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB43251760.714%

문제

The Ultrasecret Spy Organization is very concerned about recent leads concerning a secret conspiracy involving the use of the Comic Sans font.

In order to avoid groupthink, the Ultrasecret Spy Organization has decided to divide its agents in two groups. Each of the two groups will carry its own investigation. However, occassionally interaction between members of different groups will happen through some previously designated contact points (i.e. two people on different teams that are allowed to speak with each other in special circumstances). This has to be made in a way that preserves the fact that there is not much communication between the teams. To make this rule more exact, two people on the same team can have no more than one common contact on the other team.

You are given a plan for the contact points between the two groups. Your task is to determine whether this actually satisfies the constraint that two people on the same team can have no more than one common contact in the other team.

입력

The first line of the input file will contain two space-separated integers N and M, (1 ≤ N, M ≤ 2000). They represent the number of people in each of the teams. The next line will contain an integer K, (0 ≤ K ≤ NM). Each of the following K lines will containg two integers i and j, with (1 ≤ i ≤ N, 1 ≤ j ≤ M). This input will represent that person i of the first team and person j of the second team are allowed to communicate with each other.

출력

For each input, you will output one line. Its content will be YES, if the proposal satifies the constraint that two people on the same team can have no more than one common contact on the other team, and NO otherwise.

제한

예제 입력 1

5 3
4
1 1
2 1
3 1
4 1

예제 출력 1

YES

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2011 > CCO 2011 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /