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

33782번 - Efficient Pinning 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB60502379.310%

문제

While building a computer for Johnny's new library, Eric notices all the shiny pins on the new processor. He also notices, that the processor socket in the motherboard is a lot bigger than usual. After closely examining the pins and holes on the processor and motherboard, he realizes that there are a number of possible pin shapes. It seems the processor can be placed at a number of positions, but only one of them will work.

Unfortunately, Eric has a very busy life, and doesn't have the time to figure out where the processor should go. He will let a friend install the processor. Eric's friend is a very precise worker, but this also makes him slow: it will take him an hour to put in and test a possible position. Every pin on the processor is indicated by either an upercase letter, or $*$ for no pin. Every hole in the motherboard is indicated by an uppercase letter. A pin will fit in the hole if the pin and hole have the same letter, or the pin is $*$. The processor and motherboard have to be placed facing north, as indicated by a big red arrow on both of them, they cant be rotated.

Can you help Eric figure out how many hours he will have to pay his friend to get the computer running?

입력

The first line consists of two space-seperated integers $w$ and $h$ (1ドル \leq w,h \leq 400$), indicating the number of columns and rows of the motherboard. After that, $h$ lines of length $w$ follow, each line containing a string of uppercase letters, representing holes in the motherboard socket. On the next line, there are two space-seperated integers $n$ and $m$ (1ドル \leq n,m \leq 100,ドル $n \leq w,ドル and $m \leq h$), indicating the number of columns and rows of the processor. After that, $m$ lines of length $n$ follow, each line containing a string of uppercase letters and/or $*,ドル representing pins on the processor.

출력

An integer indicating the number of hours Eric's friend will be working on this computer.

제한

예제 입력 1

2 2
AB
BA
1 2
A
B

예제 출력 1

1

예제 입력 2

3 2
ABA
BAA
2 1
*A

예제 출력 2

3

힌트

출처

University > Delft University of Technology > Sjaars Kampioenschap Programmeren 2014 E번

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

출처

대학교 대회

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

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