QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#142269#5660. Simplified Genome Translationammardab3an#AC ✓1ms3584kbC++171.9kb2023-08-18 21:14:152023-08-18 21:14:16

Judging History

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

  • [2023-08-18 21:14:16]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3584kb
  • [2023-08-18 21:14:15]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

map<string, string> mp;

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

int main()
{

    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    init();

    int t; cin >> t; while(t--){

        string str;
        cin >> str;

        int n = str.size();

        string ans;

        for(int i = 0; i < n; i += 3){

            string cur = str.substr(i, 3);
            auto it = mp.find(cur);
            assert(it != mp.end());

//            cout << ' ' << cur << ' ' << (it->second) << endl;

            if(it->second == "STOP"){
                break;
            }
            else{
                ans += it->second;
            }
        }

        cout << ans << endl;
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3476kb

input:

5
UUUUAACACUUUAUCACUUAACACCAC
CAAAAUAUGAAAAAU
AUGUACUUUGCGUUUCACUAA
UUGCACUACUAC
UACGUGGGUAUC

output:

F
QNMKN
MYFAFH
LHYY
YVGI

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

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: 0ms
memory: 3500kb

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