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

16764번 - Cowpatibility 다국어

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

문제

It turns out there is one factor that matters far more than any other when determining whether two cows are compatible as potential friends: whether they like similar flavors of ice cream!

Farmer John's $N$ cows (2ドル \leq N \leq 50,000$) have each listed their five favorite flavors of ice cream. To make this list concise, each possible flavor is represented by a positive integer ID at most 10ドル^6$. Two cows are compatible if their lists contain at least one common flavor of ice cream.

Please determine the number of pairs of cows that are NOT compatible

입력

The first line of input contains $N$. Each of the following $N$ lines contain 5 integers (all different) representing the favorite ice cream flavors of one cow.

출력

Please output the number of pairs of cows that are not compatible.

제한

예제 입력 1

4
1 2 3 4 5
1 2 3 10 8
10 9 8 7 6
50 60 70 80 90

예제 출력 1

4

힌트

Here, cow 4 is not compatible with any of cows 1, 2, or 3, and cows 1 and 3 are also not compatible.

출처

Olympiad > USA Computing Olympiad > 2018-2019 Season > USACO 2018 December Contest > Gold 2번

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

출처

대학교 대회

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

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