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

31050번 - Unique Dice 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
7 초 1024 MB20151066.667%

문제

You are about to leave home for your weekly game of Pumpkins and Flagons (P&F) when a text comes in asking you to bring a large collection of identical P&F dice. They have asked the right person, for you have a very large collection of P&F dice which, unfortunately, is currently unsorted.

These dice are ordinary cubes with a number on each of the six faces. The numbers are in the range 1–6, but they do not need to be distinct. For example, $\{ 1, 2, 3, 4, 5, 6\} ,ドル $\{ 1, 1, 1, 1, 1, 1\} $ and $\{ 2, 2, 2, 4, 4, 5\} $ are all valid sets of numbers for the six faces. For this problem you want to find the size of the largest set of identical dice you can create from your very large collection. Two dice are considered identical to each other if it is possible to rotate one of the dice so that their top numbers are the same, their bottom numbers are the same, and so on for all six faces.

Figure 1: The six faces of a die.

입력

The first line contains an integer $n$ $( 1 \leq n \leq 500,円 000),ドル indicating the number of dice in your collection. The next $n$ lines each contains six integers in the range 1ドル$–6ドル,ドル separated by spaces, giving, in order, the numbers that appears on the top, bottom, front, back, left and right faces (see Figure 1).

출력

Print a single integer giving the size of the largest set of identical dice that can be made from given collection.

제한

예제 입력 1

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

예제 출력 1

2

예제 입력 2

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

예제 출력 2

1

예제 입력 3

5
1 1 2 2 2 2
1 2 1 2 2 2
1 2 2 1 2 2
1 2 2 2 1 2
1 2 2 2 2 1

예제 출력 3

4

힌트

출처

ICPC > Regionals > North America > South Central USA Regional > 2018 ICPC South Central USA Regional Programming Contest I번

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

출처

대학교 대회

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

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