QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103474#5660. Simplified Genome Translationcardinal_city#AC ✓16ms8156kbPython31.2kb2023-05-06 03:02:492023-05-06 03:02:53

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-06 03:02:53]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:8156kb
  • [2023-05-06 03:02:49]
  • 提交

answer


tns = {
    "F": "UUU UUC".split(" "),
    "L": "UUA UUG CUU CUC CUA CUG".split(" "),
    "I": "AUU AUC AUA".split(" "),
    "M": "AUG".split(" "),
    "V": "GUU GUC GUA GUG".split(" "),
    "S": "UCU UCC UCA UCG AGU AGC".split(" "),
    "P": "CCU CCC CCA CCG".split(" "),
    "T": "ACU ACC ACA ACG".split(" "),
    "A": "GCU GCC GCA GCG".split(" "),
    "Y": "UAU UAC".split(" "),
    "H": "CAU CAC".split(" "),
    "Q": "CAA CAG".split(" "),
    "N": "AAU AAC".split(" "),
    "K": "AAA AAG".split(" "),
    "D": "GAU GAC".split(" "),
    "E": "GAA GAG".split(" "),
    "C": "UGU UGC".split(" "),
    "W": "UGG".split(" "),
    "R": "CGU CGC CGA CGG AGA AGG".split(" "),
    "G": "GGU GGC GGA GGG".split(" "),
    "STOP": "UAA UAG UGA".split(" ")
}

bmap = {}
for k, v in tns.items():
    for a in v:
        bmap[a] = k

# print(bmap)

def solve(inp):
    outp = ""
    for i in range(0, len(inp), 3):
        k = inp[i:i+3]
        if k not in bmap:
            break
        elif bmap[k] == "STOP":
            break
        outp += bmap[k]
    return outp

anss = []
tc = int(input())
for i in range(tc):
    inp = input()
    anss.append(solve(inp))

print("\n".join(anss))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 8156kb

input:

5
UUUUAACACUUUAUCACUUAACACCAC
CAAAAUAUGAAAAAU
AUGUACUUUGCGUUUCACUAA
UUGCACUACUAC
UACGUGGGUAUC

output:

F
QNMKN
MYFAFH
LHYY
YVGI

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 16ms
memory: 8052kb

input:

50
GGUCAGAGGGAGGGCCUAUUGAUACGUAGUGGACUAUCAUGUUCGUGAGCAGCAUGCAGAUUACCCGUUCGGCGAGGGAGAGCCCGCUCCGAAAUGUUUAGGGAGAUAGCGGGCCACAUAGUCGCUUGAGUGCAUACUGCGUACUUUAUGUACAAGUCCCGU
AAUGGAUCACUCCUCUAUCAUUUCACUAGGUGUGACACAUGAUAUACUAACGUUCUGAAUUGGCAGUGGGGUAUGAGGCACUGAUUGGUCAUGGGACAGACUUGAGAGGAGUUGUCCUUGCUAAGCCCCGUCCC...

output:

GQREGLLIRSGLSCS
NGSLLYHFTRCDT
DASYKADEGLMFVLKDTGDYGSDYWQK
SRKVLVDRISEPLVVAYLEGTDVDGANIGSKFDGANSSAWT
FACST
LTNARTSFYALRFKDACKYTCKSLFELFSNRGQFS
II
VLLRAARISCTFIHCRCSRRGFGPLSPCPPRPLAGVGSMIYNSCYIY
TRKLSFS
ESDQC
QNGIPKKAC
PHTRRTLPPSV
GI
ATSNVCTSFHGAGASGRNVCIRGRDRPL
AF
NPFQVSRSLQPRS
IHPGYLRTGGGFRSILSVTRDG...

result:

ok 50 lines

Test #3:

score: 0
Accepted
time: 7ms
memory: 8148kb

input:

50
GGUCAGAGGGAGGGCCUAUUGAUACGUAGUGGACUAUCAUGUUCGUGAGCAGCAUGCAGAUUACCCGUUCGGCGAGGGAGAGCCCGCUCCGAAAUGUUUAGGGAGAUAGCGGGCCACAUAGUCGCUUGAGUGCAUACUGCGUACUUUAUGUACAAGUCCCGU
AAUGGAUCACUCCUCUAUCAUUUCACUAGGUGUGACACAUGAUAUACUAACGUUCUGAAUUGGCAGUGGGGUAUGAGGCACUGAUUGGUCAUGGGACAGACUUGAGAGGAGUUGUCCUUGCUAAGCCCCGUCCC...

output:

GQREGLLIRSGLSCS
NGSLLYHFTRCDT
DASYKADEGLMFVLKDTGDYGSDYWQK
SRKVLVDRISEPLVVAYLEGTDVDGANIGSKFDGANSSAWT
FACST
LTNARTSFYALRFKDACKYTCKSLFELFSNRGQFS
II
VLLRAARISCTFIHCRCSRRGFGPLSPCPPRPLAGVGSMIYNSCYIY
TRKLSFS
ESDQC
QNGIPKKAC
PHTRRTLPPSV
GI
ATSNVCTSFHGAGASGRNVCIRGRDRPL
AF
NPFQVSRSLQPRS
IHPGYLRTGGGFRSILSVTRDG...

result:

ok 50 lines