Under construction

Still being built. Things may change

Glitching screen

Interview

Time limit1sMemory limit1024 MB

Summary
Given n candidate h by w pixel renderings and a current screen that may have dead pixels stuck off, decide whether exactly one stop matches.
Level

Medium5 of 10

Topics
String, Implementation, Brute force, Matrix
Solved
No attempts yet

Problem

Petter is taking the local train in a new city for the first time. He is well prepared and has memorized the names of all the stops. However, some of the pixels on the monitor that displays the upcoming stop are broken. Can you help him decide what the next stop is?

Input

The first line of input consists of three integers 1≤h≤1001 \leq h \leq 100, 1≤w≤1001 \leq w \leq 100 and 1≤n≤1001 \leq n \leq 100, the height and width of the screen in pixels and the number of train stops, respectively. Then there are h⋅nh \cdot n lines, where line i⋅hi\cdot h to i⋅h+h−1i\cdot h + h - 1 shows how train stop ii is rendered on a fully functioning screen (for stops i∈{0,1,2,…,n−1}i \in \{0, 1, 2, \ldots, n-1\}). The input ends with hh more lines that shows the current screen. Pixels on the screen that are turned on are denoted by x and pixels that are turned off are denoted by a period (.). If a screen is broken, it means that one or more of the pixels are always off.

Output

Output yes if you can tell him what the next stop is, and no otherwise.

Examples2

  1. Example 1

    Input
    3 9 2
    x.x.x.xxx
    xxx.x..x.
    x.x.x..x.
    xx..x.xxx
    x.x.x..x.
    xx..x..x.
    ....x....
    .x..x....
    ....x....
    
    Expected output
    yes
    
  2. Example 2

    Input
    1 4 2
    x.xx
    xx.x
    x..x
    
    Expected output
    no