RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
ICPC00082

E. Evolution in Parallel

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
Unrated 레이팅 미적용
난이도
2s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

It is 2178, and alien life has been discovered on a distant planet. There seems to be only one species on the planet and they do not reproduce as animals on Earth do. Even more amazing, the genetic makeup of every single organism is identical! The genetic makeup of each organism is a single sequence of nucleotides. The nucleotides come in three types, denoted by ‘A’ (Adenine), ‘C’ (Cytosine), and ‘M’ (Muamine). According to one hypothesis, evolution on this planet occurs when a new nucleotide is inserted somewhere into the genetic sequence of an existing organism. If this change is evolutionarily advantageous, then organisms with the new sequence quickly replace ones with the old sequence. It was originally thought that the current species evolved this way from a single, very simple organism with a sing\(le-nu\)cleotide genetic sequence, by way of mutations as described above. However, fossil evidence suggests that this might not have been the case. Right now, the research team you are working with is trying to validate the concept of “parallel evolution” – that there might actually have been two evolutionary paths evolving in the fashion described above, and eventually both paths evolved to the single species present on the planet today. Your task is to verify whether the parallel evolution hypothesis is consistent with the genetic material found in the fossil samples gathered by your team.

제약
입력 형식

The input begins with a number \(n\) (\(1 \le n \le 4\,000\)) denoting the number of nucleotide sequences found in the fossils. The second line describes the nucleotide sequence of the species currently living on the planet. Each of the next \(n\) lines describes one nucleotide sequence found in the fossils. Each nucleotide sequence consists of a string of at least one but no more than 4 000 letters. The strings contain only upp\(er-ca\)se letters A, C, and M. All the nucleotide sequences, including that of the currently live species, are distinct.

출력 형식

Display an example of how the nucleotide sequences in the fossil record participate in two evoluti\(on- ar\)y paths. The example should begin with one line containing two integers \(s_{1}\) and \(s_{2}\), the number of nucleotide sequences in the fossil record that participate in the first path and second path, respectively. This should be followed by \(s_{1}\) lines containing the sequences attributed to the first path, in chronological order (from the earliest), and then \(s_{2}\) lines containing the sequences attributed to the second path, also in chronological order. If there are multiple examples, display any one of them. If it is possible that a sequence could appear in the genetic history of both species, your example should assign it to exactly one of the evolutionary paths. If it is impossible for all the fossil material to come from two evolutionary paths, display the word impossible.

예제 1
입력
5
AACCMMAA
ACA
MM
ACMAA
AA
A
출력
1 4
MM
A
AA
ACA
ACMAA
예제 2
입력
3
ACMA
ACM
ACA
AMA
출력
impossible
예제 3
입력
1
AM
MA
출력
impossible
예제 4
입력
4
AAAAAA
AA
AAA
A
AAAAA
출력
0 4
A
AA
AAA
AAAAA
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC World Finals 2015

평가 및 의견

E. Evolution in Parallel

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

E. Evolution in Parallel

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8