QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#133631 | #5660. Simplified Genome Translation | Nicolas125841 | AC ✓ | 3ms | 3772kb | C++17 | 1.6kb | 2023-08-02 12:09:52 | 2023-08-02 12:09:55 |
Judging History
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";
}
}
Details
Tip: Click on the bar to expand more detailed information
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