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

31527번 - Tournament Matchmaking 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 2048 MB29202068.966%

문제

You are organizing a recreational rugby tournament. A rugby team has 15ドル$ distinct roles, numbered 1ドル$ to 15ドル$. Each team in the tournament must have exactly 15ドル$ players, each fulfilling one of the roles. Although several groups of friends showed up to play in the tournament, none of the groups are large enough to form a complete team. You would like to create teams by merging some pairs of groups together.

Each group has between 1ドル$ and 14ドル$ players (inclusive) and you know that each player has exactly 2ドル$ potential roles they could play on a team. Determine the maximum number of valid teams you can form. A team is valid if it is made of exactly two groups, it has exactly 15ドル$ players (no more, no fewer), and every role on the team is played by a different player able to play that role. A group cannot be part of more than one team.

입력

The first line contain a single integer $n (1 \le n \le 500),ドル the number of groups.

Following this line are $n$ group descriptions. The first line of a group description contains a single integer $k (1 \leq k \leq 14),ドル the size of the group. The following $k$ lines each contain two space-separated integers $a$ and $b$ $(1 \leq a < b \leq 15),ドル representing a player that can fulfill either role $a$ or role $b$ on team.

출력

Output the maximum number of valid teams that can be created by merging pairs of groups together.

제한

예제 입력 1

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

예제 출력 1

1

힌트

출처

ICPC > Regionals > North America > Mid-Central Regional > 2023 Mid-Central USA Programming Contest D번

  • 문제를 만든 사람: Unknown
(追記) (追記ここまで)

출처

대학교 대회

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

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