QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133631#5660. Simplified Genome TranslationNicolas125841AC ✓3ms3772kbC++171.6kb2023-08-02 12:09:522023-08-02 12:09:55

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 12:09:55]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3772kb
  • [2023-08-02 12:09:52]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main(){
    cin.tie(NULL)->sync_with_stdio(false);

    int t;
    cin >> t;

    regex rgen("[A-Z]{3}");

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

    while(t--){
        string s;
        cin >> s;

        auto sbegin = sregex_iterator(s.begin(), s.end(), rgen);
        auto send = sregex_iterator();
        smatch match;

        for(auto i = sbegin; i != send; i++){
            string nuc = i->str();

            for(auto pattern : patterns){
                if(regex_match(nuc, match, pattern.first)){
                    cout << pattern.second;

                    goto jmp;
                }
            }
            
            break;

            jmp:
                continue;
        }

        cout << "\n";
    }
}

詳細信息

Test #1:

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

input:

5
UUUUAACACUUUAUCACUUAACACCAC
CAAAAUAUGAAAAAU
AUGUACUUUGCGUUUCACUAA
UUGCACUACUAC
UACGUGGGUAUC

output:

F
QNMKN
MYFAFH
LHYY
YVGI

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 3ms
memory: 3672kb

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: 3772kb

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