PivotOJ

Evolutionary Excerpt

시간 제한: 1000ms메모리 제한: 1024MB출처: BAPC 2021BOJ 23379

문제

Being a renowned Bacteria and Protein Collector, you are leading research into the spread of bacteria and virus proteins. As part of this research, public locations spread over the entire world have been swabbed for DNA samples.

The sequenced DNA samples have just come back from the lab, and you would now like to prove your hypothesis that even though the samples have been taken in different continents, they are still related.  However, as it turns out, they are not related. In fact, the samples are independent uniformly random DNA sequences containing characters in "ACGT".  This means that each character in each sequence has a probability of exactly 25%25\% of being each of 'A', 'C', 'G', or 'T'.

Nevertheless, you would still like to convince your colleagues that the samples are related. You decided that two pieces of DNA are related when they share at least half of their code: if the sequences both have length nn they are related when they share a common subsequence1 of length at least 12n\frac 12 n.

Given two independent uniformly random DNA sequences AA and BB, your task is to find a common subsequence to prove that they are related. You already did some analysis, and confirmed that the probability of failure is in fact less than 10100010^{-1000} per instance when n=106n=10^6.

1A sequence SS is a subsequence of a sequence AA when SS can be obtained from AA by deleting some or none of the elements of AA while preserving the order of the remaining elements.

입력

The input consists of:

  • One line with an integer nn, the length of the DNA sequences.
  • One line with a string AA consisting of nn independent uniformly random characters in "ACGT".
  • One line with a string BB consisting of nn independent uniformly random characters in "ACGT".

Your submission will be run on exactly 100100 test cases, all of which will have n=106n=10^6. The samples are smaller and for illustration only.

Each of your submissions will be run on new random test cases.

A testing tool is provided to run your submission on large random inputs. It does not verify the correctness of your answer.

출력

Output a common subsequence of length at least 12n\frac 12 n.

If there are multiple valid solutions, you may output any one of them.

예제

예제 1

입력
20
TCCGATCGCTCTAGAACTAG
CTCACTAGCTCTTCGCCGAC
출력
TCATGCTCTGCG

예제 2

입력
20
AGGCTTGAACGATAGACAAC
AGCTAAAGCTAGCTAGACTT
출력
AGCTAACATAGAC
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.