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

6183번 - Word Power 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB98766681.481%

문제

Farmer John wants to evaluate the quality of the names of his N (1 <= N <= 1000) cows. Each name is a string with no more than 1000 characters, all of which are non-blank.

He has created a set of M (1 <= M <= 100) 'good' strings (no longer than 30 characters and fully non-blank). If the sequence letters of a cow's name contains the letters of a 'good' string in the correct order as a subsequence (i.e., not necessarily all next to each other), the cow's name gets 1 quality point.

All strings is case-insensitive, i.e., capital letters and lower case letters are considered equivalent. For example, the name "Bessie" contains the letters of "Be", "sI", "EE", and "Es" in the correct order, but not "is" or "eB". Help Farmer John determine the number of quality points in each of his cow's names.

입력

  • Line 1: Two space-separated integers: N and M
  • Lines 2..N+1: Line i+1 contains a string that is the name of the ith cow
  • Lines N+2..N+M+1: Line N+i+1 contains the ith good string

출력

  • Lines 1..N+1: Line i+1 contains the number of quality points of the ith name

제한

예제 입력 1

5 3
Bessie
Jonathan
Montgomery
Alicia
Angola
se
nGo
Ont

예제 출력 1

1
1
2
0
1

힌트

There are 5 cows, and their names are "Bessie", "Jonathan", "Montgomery", "Alicia", and "Angola". The 3 good strings are "se", "nGo", and "Ont".

"Bessie" contains "se", "Jonathan" contains "Ont", "Montgomery" contains both "nGo" and "Ont", Alicia contains none of the good strings, and "Angola" contains "nGo".

출처

Olympiad > USA Computing Olympiad > 2007-2008 Season > USACO US Open 2008 Contest > Silver 2번

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

출처

대학교 대회

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

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