QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133181 | #5660. Simplified Genome Translation | tselmegkh# | AC ✓ | 1ms | 3596kb | C++20 | 2.2kb | 2023-08-01 17:01:31 | 2023-08-01 17:02:17 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
using namespace std;
const int N = 2e5 + 5, inf = 1e9;
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define sz(x) (int)x.size()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
map<string, char> d;
void solve(){
string s;
cin >> s;
int n = sz(s);
for(int i = 0; i < sz(s) - 2; i += 3){
string t = s.substr(i, 3);
char res = d[t];
if(d[t] == '#')break;
cout << d[t];
}
cout << '\n';
}
void f(string s, char c){
d[s] = c;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t = 1;
cin >> t;
f("UUU", 'F');
f("UUC", 'F');
f("UUA", 'L');
f("UUG", 'L');
f("CUU", 'L');
f("CUC", 'L');
f("CUA", 'L');
f("CUG", 'L');
f("AUU", 'I');
f("AUC", 'I');
f("AUA", 'I');
f("AUG", 'M');
f("GUU", 'V');
f("GUC", 'V');
f("GUA", 'V');
f("GUG", 'V');
f("UCU", 'S');
f("UCC", 'S');
f("UCA", 'S');
f("UCG", 'S');
f("AGU", 'S');
f("AGC", 'S');
f("CCU", 'P');
f("CCC", 'P');
f("CCA", 'P');
f("CCG", 'P');
f("ACU", 'T');
f("ACC", 'T');
f("ACA", 'T');
f("ACG", 'T');
f("GCU", 'A');
f("GCC", 'A');
f("GCA", 'A');
f("GCG", 'A');
f("UAU", 'Y');
f("UAC", 'Y');
f("CAU", 'H');
f("CAC", 'H');
f("CAA", 'Q');
f("CAG", 'Q');
f("AAU", 'N');
f("AAC", 'N');
f("AAA", 'K');
f("AAG", 'K');
f("GAU", 'D');
f("GAC", 'D');
f("GAA", 'E');
f("GAG", 'E');
f("UGU", 'C');
f("UGC", 'C');
f("UGG", 'W');
f("CGU", 'R');
f("CGC", 'R');
f("CGA", 'R');
f("CGG", 'R');
f("AGA", 'R');
f("AGG", 'R');
f("GGU", 'G');
f("GGC", 'G');
f("GGA", 'G');
f("GGG", 'G');
f("UAA", '#');
f("UAG", '#');
f("UGA", '#');
while(t--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3596kb
input:
5 UUUUAACACUUUAUCACUUAACACCAC CAAAAUAUGAAAAAU AUGUACUUUGCGUUUCACUAA UUGCACUACUAC UACGUGGGUAUC
output:
F QNMKN MYFAFH LHYY YVGI
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3556kb
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: 3492kb
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