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

6755번 - Who is taller? 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB199996348.837%

문제

You have a few minutes before your class starts, and you decide to compare the heights of your classmates. You don’t have an accurate measuring device, so you just compare relative heights between two people: you stand two people back-to-back, and determine which one of the two is taller. Conveniently, none of your classmates are the same height, and you always compare correctly (i.e., you never make a mistake in your comparisons).

After you have done all of your comparisons, you would like to determine who the tallest person is between two particular classmates.

입력

The first line contains two integers N and M separated by one space. N, the number of people in the class, is an integer with 1 ≤ N ≤ 1000000. M, the number of comparisons that have already been done, is an integer with 1 ≤ M ≤ 10000000. Each of the next M lines contains two distinct integers x and y (1 ≤ x, y ≤ N) separated by a space, indicating that person number x was determined to be taller than person number y. Finally, the last line contains two distinct integers p and q (1 ≤ p, q ≤ N) separated by one space: your goal is to determine, if possible, whether person p is taller than person q. Note that it may be the case that neither p nor q occur in the input concerning measurements between classmates, and each measurement between any two particular people will be recorded exactly once.

출력

The output is one line, containing one of three possible strings:

  • yes (if p is taller than q),
  • no (if q is taller than p),
  • unknown (if there is not enough information to determine the relative heights of p and q).

제한

예제 입력 1

10 3
8 4
3 8
4 2
3 2

예제 출력 1

yes

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2013 > CCC 2013 Senior Division 4번

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

출처

대학교 대회

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

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