TheForces Round #26 (Readall-Forces) |
---|
Finished |
You are given $$$20$$$ decimal strings (a decimal string is a string consisting of characters 0 to 9) each of length $$$k$$$ ($$$k$$$ is a multiple of $$$10$$$).
You have to generate a decimal string of length $$$19k/10$$$ such that at least $$$2$$$ of the given strings are present as subsequences (not necessary contiguous) of the generated string and print it.
If it is impossible to find such a string, print -1.
In the first line of input, there is an integer $$$k$$$ $$$( 1 \le k \le 10^5, k=0 \mod 10)$$$ indicating the length of each decimal string.
Then there will be $$$20$$$ lines, each line contains a decimal string of length $$$k$$$.
If it's not possible to generate such string print -1. Otherwise print the generated string.
1077000166732682666656912557360365043179498140497834429027900951735109518685927577100429078840342474499343949853013049652234838927938172454939472014008517880325170749973594312612530251566485529045810227
6508143179490497834
In the first test case, you'll find the $$$4$$$th string 6508143179490497834 and $$$5$$$th string 6508143179490497834 in the output.
Name |
---|