#P10836. 『FLA - I』歌静河

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

『FLA - I』歌静河

Background

You can cry

Drinking your eyes

Do you miss the sadness when it's gone

And you let the river run wild

And you let the river run wild

— The River by AURORA

Problem 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 (i−1) mod 26+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 (1−1) mod 26+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 (2−1) mod 26+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 n≤n \leq Special Property
1∼31 \sim 3 1010 No
4∼64 \sim 6 10510^5 Yes
7∼107 \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, 1≤n≤1051 \leq n \leq 10^5, 1≤m≤2n1 \leq m \leq 2n, the string a,ba,b contains only the character # and lowercase letters.