QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#142269 | #5660. Simplified Genome Translation | ammardab3an# | AC ✓ | 1ms | 3584kb | C++17 | 1.9kb | 2023-08-18 21:14:15 | 2023-08-18 21:14:16 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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