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

21288번 - Bokstavstärningar 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB34312796.429%

문제

Klara has $N$ dices with letters written on them. Each die has a letter on each of its $K$ sides. By throwing the dice and rearranging them in some arbitrary order, you can make construct a word with $N$ letters.

Write a program to count the number of valid words that can be constructed using Klara's dice. You will get a wordlist, that contains all the $M$ valid $N$-letter words.

Figure 1: An illustration of the first example. Since $K = 3,ドル each die has three sides. You can also write STOL and MASK, but not NATT or KOST.

입력

The first line of input contains three space-separated integers $N,ドル $K$ and $M$.

The next $N$ lines each describe a die. Line $i$ will contain $K$ letters, the letters on the sides of the $i$:th die.

Finally, there will be $M$ lines, the valid words. Each line will contain an $N$-letter word.

All words will only capital letters A-Z.

No letter will appear on more than one side of a die.

출력

Your program should print a single integer: the number of valid words that can be written.

제한

서브태스크

번호배점제한
19

$K = 2, N \le 4, M \le 100$

29

$K \le 6, N \le 5, M \le 100$

312

$K \le 20, N \le 6, M \le 1000$

414

$K \le 15, N \le 6, M \le 10,000円$

521

$K \le 20, N \le 6, M \le 100,000円$

635

$K \le 10, N \le 13, M \le 500$

예제 입력 1

4 3 5
TSU
NKT
KMO
LJA
KATT
NATT
STOL
MASK
KOST

예제 출력 1

3

힌트

출처

Olympiad > Swedish Olympiad in Informatics > 2016 > Online Qualification D번

  • 문제를 만든 사람: Pär Söderhjelm

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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