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

8059번 - Speleology 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB83322536.232%

문제

A team of speleologists organizes a training in the Great Cave of Byte Mountains. During the training each speleologist explores a route from Top Chamber to Bottom Chamber. The speleologists may move down only, i.e. the level of every consecutive chamber on a route should be lower then the previous one. Moreover, each speleologist has to start from Top Chamber through a different corridor and each of them must enter Bottom Chamber using different corridor. The remaining corridors may be traversed by more then one speleologist. How many speleologists can train simultaneously?

Write a program which:

  • reads the cave description from the standard input,
  • computes the maximal number of speleologists that may train simultaneously,
  • writes the result to the standard output.

입력

In the first line of the standard input there is one integer n (2 ≤ n ≤ 200), equal to the number of chambers in the cave. The chambers are numbered with integers from 1 to n in descending level order - the chamber of greater number is at the higher level than the chamber of the lower one. (Top Chamber has number 1, and Bottom Chamber has number n). In the following n-1 lines (i.e. lines 2,3,…,n) the descriptions of corridors are given. The (i+1)-th line contains numbers of chambers connected by corridors with the -th chamber. (only chambers with numbers grater then i are mentioned). The first number in a line, m, 0 ≤ m ≤ (n-i+1), is a number of corridors exiting the chamber being described. Then the following integers are the numbers of the chambers the corridors are leading to.

출력

Your program should write one integer in the only line of the standard output. This number should be equal to the maximal number of speleologists able to train simultaneously.

제한

예제 입력 1

12
4 3 4 2 5
1 8
2 9 7
2 6 11
1 8
2 9 10
2 10 11
1 12
2 10 12
1 12
1 12

예제 출력 1

3

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 1998/1999 > Stage 2 2번

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

출처

대학교 대회

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

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