아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Display

시간 제한2초메모리 제한512 MB

요약
주어진 글리프로 만든 문자열을 밀어서 표시할 때 어떤 픽셀이 s번 이상 바뀌는 가장 짧은 문자열을 찾는다.
난이도

보통10점 중 7점

유형
문자열 매칭, 시뮬레이션, 완전 탐색
정답자
아직 제출이 없습니다

문제

St. Petersburg Supway tests new SupLED ticker displays. The display shows a monochrome sliding text line printed in SupFont. The text is only shown once and does not loop. Each SupFont character has a fixed size of w×hw \times h pixels, where each pixel is either on or off. There is a column of off pixels between consecutive characters of the text. The text sliding speed is one pixel per tick.

The main service life factor is the number of switches: when a pixel turns from on to off or vice versa. A pixel breaks after ss switches. If a pixel's state is not changed between two ticks, no switches occur.

The services team needs to estimate the shortest text that causes any of the pixels to break. All pixels are off before the text is shown.

입력

The first line of the input contains four integers nn, ww, hh, and ss --- the number of characters in SupFont, width and height of each character, and the number of switches after which a pixel becomes broken (1≤n≤941 \le n \le 94; 1≤w,h≤301 \le w, h \le 30; 1≤s≤1061 \le s \le 10^6).

The following lines contain SupFont character descriptions. The first line of each description contains an ASCII character (only characters with codes between 33 and 126, inclusive, are used). The character's image with hh lines of length ww follows, '#' denotes an on pixel, and '.' denotes an off pixel. Each image has at least one on pixel.

All described ASCII characters are distinct, but some of them may have the same image.

출력

Output a single line containing at most ss characters: the shortest text that, when shown on a display, causes some pixel to switch at least ss times. If there are multiple solutions, output any of them.

예제1

  1. 예제 1

    입력
    3 4 5 16
    I
    .#..
    #.#.
    .#..
    .#..
    ###.
    C
    .##.
    #..#
    #...
    #..#
    .##.
    P
    ###.
    #..#
    ###.
    #...
    #...
    
    예상 출력
    ICPC