#P10836. 『FLA - I』歌静河

    ID: 10324 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>模拟字符串贪心洛谷原创O2优化洛谷月赛

『FLA - I』歌静河

Description

Qiu has two strings a,ba,b of length nn that only contain # and lowercase letters.

These two strings contain mm #s in total. Qiu intends to perform mm operations to replace all #s in the two strings with lowercase letters. For the ii-th operation, he has to choose a string from a,ba,b and replace the first # in this string from left to right with the (i1)mod26+1(i-1) \bmod 26 +1-th lowercase letter. He cannot choose a string that does not contain #.

Qiu has a friend who loves art. He wants to minimize the lexicographic order of the string aa after performing mm operations. Qiu thought that programming is also a kind of art, and in this way, their hearts will be closer.

Input Format

The first line contains two positive integers n,mn, m.

The second line contains a string aa of length nn.

The last line contains a string bb of length nn.

Output Format

Output one line of one string, indicating the minimum aa in lexicographic order that can be obtained after executing mm operations.

8 2
th#nkyou
#estwish

thankyou

16 5
##soluteradian#e
your#awnwillcom#

absoluteradiance

40 45
hhuj#pzr#k#mmd#z##y#o####m##j##tga#k#t#g
m########be#######vf##a#j###ypuf###pr###

hhujapzrakbmmdczdeyfoghijmkljmntgaokptqg

Hint

「Sample Explanation #1」

In the first operation, Qiu selects the string aa and replaces the # into aa with the (11)mod26+1=1(1-1) \bmod 26+1=1-st lowercase letter, i.e. a; In the second operation, Qiu selects the string bb and replaces the # in bb with the (21)mod26+1=2(2-1) \bmod 26+1=2-nd lowercase letter, i.e. b. The final string aa is thankyou, which can be proved to be the smallest aa in lexicographic order after executing mm operations.

「Constraints」

Test Id nn \leq Special Property
131 \sim 3 1010 No
464 \sim 6 10510^5 Yes
7107 \sim 10 No
  • Special Property: It is guaranteed that there is a string in a,ba,b that does not contain #.

Each test is worth 1010 points.

For all tests, 1n1051 \leq n \leq 10^5, 1m2n1 \leq m \leq 2n, the string a,ba,b contains only the character # and lowercase letters.