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

33781번 - Diagnosis 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB79714994.231%

문제

In the PHP (Paradise Hospital of Prague) they cure people with a lot of different diseases. The PHP is dealing with a shortage of medical personal, therefore the director is afraid of doctors getting sloppy. Doctors make a diagnosis based on the knowledge they gained in university. So there is a known list of possible diseases and a known list of possible symptoms a patient can have. A doctor makes a diagnosis of one or multiple diseases. Those diseases have known symptoms that need to match exactly with the symptoms of the patient.

More formally: given a set of diseases $D = \{d_1, d_2, ..., d_n\},ドル a set of symptoms $S = \{s_1, s_2, ..., s_m\}$ and a function that represents the knowledge about diseases and their symptoms. $f(d) = S'$ with $S' \subseteq S$ and $d \subseteq D$. When a given $D' \subseteq D$ check whether or not the the condition $S = \bigcup_{d \in D'}f(d)$ is true. When it is print "yes" else print "no".

입력

  • One line with two integers $n$ and $m,ドル with 1ドル \leq n \leq 1000$ the number of diseases and 1ドル \leq m \leq 1000$ the number of symptoms. The patient has all symptoms $s_1$ to $s_m$.
  • One line with one integer $k$ followed by $k$ integers: the set of diseases $D'$ the patient has according to the doctor $(D' \subseteq D)$.
  • $n$ lines, corresponding to diseases $d_1$ to $d_n,ドル with an integer $p$ followed by $p$ integers: The symptoms belonging to disease $i$. These symptoms are given in ascending order.

출력

Print "yes" if the symptoms of the diagnosed diseases exactly match the patient's symptoms. Print "no" otherwise.

제한

예제 입력 1

5 6
3 3 4 5
3 1 2 3
3 2 3 4
2 5 6
3 1 4 5
4 1 2 3 5

예제 출력 1

yes

예제 입력 2

5 6
4 1 2 4 5
3 1 2 3
3 2 3 4
2 5 6
3 1 4 5
4 1 2 3 5

예제 출력 2

no

힌트

출처

University > Delft University of Technology > Sjaars Kampioenschap Programmeren 2014 D번

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

출처

대학교 대회

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

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