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

33328번 - The Lottery WINNER 다국어

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

문제

WINNER is fed up with implementing the Z-function for the 500-th time at his new accountant job at NUP, and now he is looking for a quick way to retire. Thanks to his wide network of connections, he managed to obtain the winning numbers from all the $n$ lotteries in Paphos. These winning numbers are written in base 12ドル,ドル where the numbers can include leading zeros.

However, the lotteries couldn't agree on a standard for representing the digits 10ドル$ and 11ドル$ using letters (from the uppercase English alphabet), so each lottery uses its own choice of two letters for these values. Despite having access to this information, WINNER is still uncertain about the exact rules for winning. He suspects that, in order to claim a prize, he only needs to correctly guess at least one digit from the winning number for each lottery.

WINNER forgot how to write with pen and paper, so he needs help figuring out the minimum number of unique alphanumerics he should learn in order to "win" (according to his understanding) at all the lotteries.

입력

The input begins with a single integer $n$ (1ドル \leq n \leq 2.5 \cdot 10^5$), representing the number of lotteries.

Each of the next $n$ lines contains a number in base 12ドル,ドル representing the winning numbers for each lottery. For each line, there is an uppercase letter that means the digit 10ドル,ドル and a different uppercase letter that means the digit 11ドル$. This line can contain only digits and these two letters.

It is guaranteed that the total length of all the numbers is at most 4ドル \cdot 10^6$.

출력

The output should consist of a single integer, $k,ドル indicating the minimum number of unique alphanumerics WINNER needs to learn in order to believe he can win every lottery.

제한

예제 입력 1

4
EEXEE
X221
DEE
2555539BD

예제 출력 1

2

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 7: Farewell Contest H번

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

출처

대학교 대회

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

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