Back
Close

Merging (part 1)

Statement

 Goal

You have 2 square NxN tables, contains only # and & symbols. You need to merge them to one so that all # are replaced all matching &.
Input
On the first line you have number N, size of tables.
On next 2*N+1 lines you have table sets, separated with empty line.
Output
N lines, set of new table.
Constraints
Example
Input
2
&#
#&

&&
&&
Output
&#
#&

Game modes
Fastest, Shortest

Test cases
Only one Test
Input
2 &# #& && &&
Output
&# #&

Key in Lock Validator
Input
3 ### &&& ### &&& ### &&&
Output
### ### ###

Overlay Test
Input
5 ##### &#&#& #&#&# &&&&& ##### ##### #&#&# #&#&# ##&## &&&&&
Output
##### ##### #&#&# ##&## #####

Alone Validator
Input
1 & #
Output
#

X-pattern Test
Input
8 ######## #&&&&&&# #&&&&&&# #&&&&&&# #&&&&&&# #&&&&&&# #&&&&&&# ######## &&&&&&&& &#&&&&#& &&#&&#&& &&&##&&& &&&##&&& &&#&&#&& &#&&&&#& &&&&&&&&
Output
######## ##&&&&## #&#&&#&# #&&##&&# #&&##&&# #&#&&#&# ##&&&&## ########

Randomized 13x13 Validator
Input
13 &#&#&&&&&&&## #&&&#&&&&&&&& &&&&&##&&#&&& &&&&#&&&&#&&& ##&&##&&&&#&& &&#&&#&&&&&&& &&&&#&&#&&#&& #&&&&&&&#&#&# &&&&&&&##&#&& &&&&###&&&&&# &&&&#&#&&&#&& &&#&&&&&#&&&& &&&&&&#&&&&#& #&&&&#&&&&&&& &&#&&#&#&&#&& &&&&#&&&#&#&& &#&&&##&&###& #&&&######&&& &#&#&#&&&#&&& &&&&&##&#&#&& ##&&&&&&####& ###&&&#&##&#& &&&&#&&#&&&## #&&&&#&&&#&&# &#&&&&#&&&#&& #&&&&&###&&&&
Output
##&#&#&&&&&## #&#&##&#&&#&& &&&&###&###&& &#&&###&&###& ##&&#######&& &###&#&&&#&&& &&&&#####&#&& ##&&&&&&##### ###&&&######& &&&&####&&&## #&&&###&&##&# &##&&&#&#&#&& #&&&&&###&&#&

Same tables Test
Input
3 #&# &#& #&# #&# &#& #&#
Output
#&# &#& #&#

Randomized 6x6 Validator
Input
6 &&&&&& ##&&&# #&&#&& &&#&#& #####& &#&&&& &&#&#& ##&### ##&&#& &&&##& #&###& &###&&
Output
&&#&#& ##&### ##&##& &&###& #####& &###&&

Randomized 10x10 Test
Input
10 ###&&#&### #####&&&## #&&&&&&&#& &&#&&&&&&& &&#&&&&&## &#&#####&# #&&&###### ##&#&&#&&& &##&&&&&## ###&&####& &&&&&##### &#&###&&## &####&###& &&##&&#&&& ##&##&&&&& ###&#&##&# &&#&##&#&& &#&#&&#### &##&&###&& #&&#&&#&&#
Output
###&&##### ######&&## #####&###& &&##&&#&&& #####&&&## ########&# #&#&###### ##&#&&#### &##&&##### ####&#####

Randomized 25x25 Validator
Input
25 #&&&&#&&#&&&&&&&&&&&&&#&# &&&&&&####&##&#&&##&&&##& #&&##&&&###&#&&#&#&##&#&& &#&&&&##&&#&##&&#&&#&#&&& &&&#&&&&&#&&#&#&&#&##&&&& &#&###&###&&###&##&#&&&&& #&#&#&&&&#&&&&&&&&#&&&&&& &&&&#&&&#####&&#&#&&#&&#& &&#&&#&#&&&&&&&&&&#&##&#& &#&&&##&&&&#&#&#&&&&&#&&& #&&&&#&&#&&##&#&&#&&#&### &&&#&&&##&&#&##&&&#&&&&#& #&&&#&&&&&&#&&#&&####&##& #&&&&&##&&&##&#&#&&&#&### &###&&&&&&#&&&&&##&#&&### ###&&&#&&#&&&&#&&&&&&&#&& &&#&#&######&#&#&&&&&&#&& &&#&&&#&&#&#&&##&&&&##&## &&&###&#&&&#&&&&#&#&&&&#& &&&##&&&&&&#&#&&&&&&&&&#& &#&&&&#&#&#&##&&&##&&&#&& ##&#&&&&##&#&#&&&&&&&&&&& &&&##&&&#&&&#&#&##&##&&&& #&####&&#&#&&&&&&&&&#&&#& &&&&####&&&&&#&&&&&&&&#&# &#&##&&&&#&#&&&&&#&&&&&#& &&&#&#&&##&&&&###&&&##&&# #&####&&&##&&&#&&&###&&&& &&#&#&##&&#&&###&#&&&&&## &###&&##&&&&&#&&&&&&##&&# #&&#&&#&#&&#&#&##&#&&&&&& &&#&&&&&&&&#&&#&&&&&&#&&& &&&#&&&#&#&#&&&##&&&#&#&& &#&&&&&&&#&#&##&##&&&&#&# #&##&&&#&&##&&&&&###&&&&& #&&&&&&##&&&#&&#&&&&&&&## &&&&&#&#&#&&#####&&&&&&#& #&&#&#&###&&&&#&##&&#&&#& &&#&&#&&&&&&&&&&&&#&&#&&# &#&&&#&##&#&&&##&&&&&&#&# &&&&&&&&#&&&&#&&&&&&&&### &&&&&#&&&&&&&#&&#&&#&&&&& &&##&&&&&&&#&##&&&###&#&& &##&&&#&&#&&&&&&&&&&#&#&# &&#&&&&&&#&&#&&#&&#&#&#&& &&&&&&&&#&#&&#&&#&&&&&#&& &&####&&#&&#&&#&&&&#&#&&& &#&&#&#&&&#&&#&&&#&&#&&&# &&&&&##&&#&##&#&##&&##&&& &&&&#&&&#&##&&#&&&&##&&&#
Output
##&###&&##&#&&&&&#&&&&### &&&#&#####&##&#####&##### #&####&&###&#&##&####&#&& &##&#&##&&#&######&#&#&## &###&&##&#&&###&&#&###&&# ##&#######&#########&&&&& #&#&#&&&&#&#&&#&&&#&&#&&& &&&##&&######&&###&&#&##& &##&&#&#&#&#&##&###&##### ####&###&&##&#&#&###&#&&& #&&&&#&##&&##&##&#&&#&### &&&#&#&###&######&#&&&&#& #&&###&###&#&&#&#####&##& #&#&&###&&&##&#&#&#&##### &###&#&##&#&&&####&#&&### ###&&&#&##&&&##&&&&&&&### &&#&########&#&##&&#&&#&& &&##&&#&&#&#&###&&####### &#######&#&#&&&&#&#&#&### &&###&&&&#&###&#&&#&#&##& &#&&&&#&#&#&##&&###&&&#&& ######&&##&#&##&&&&#&#&&& &#&##&#&#&#&###&##&##&&&# #&#####&#####&#&##&&##&#& &&&&#####&##&##&&&&##&#&#

Solution language

Solution

Stub generator input