QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#97403 | #5660. Simplified Genome Translation | aguo123 | WA | 3ms | 3368kb | C++11 | 1.6kb | 2023-04-16 18:32:15 | 2023-04-16 18:32:16 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<map>
using namespace std;
typedef long long LL;
const int N=2e5+10;
int n,T;
map<string,char>mp;
int p[1100];
int find(int x){
if(p[x]!=x)return p[x]=find(p[x]);
return p[x];
}
void init(){
mp["UUU"]=mp["UUC"]='F';
mp["UUA"]=mp["UUG"]=mp["CUU"]=mp["CUC"]=mp["CUA"]=mp["CUC"]='L';
mp["AUU"]=mp["AUC"]=mp["AUA"]='I';
mp["AUG"]='M';
mp["UCU"]=mp["UCC"]=mp["UCA"]=mp["UCG"]=mp["AGU"]=mp["AGC"]='S';
mp["GUU"]=mp["GUC"]=mp["GUA"]=mp["GUG"]='V';
mp["CCU"]=mp["CCC"]=mp["CCA"]=mp["CCG"]='P';
mp["ACU"]=mp["ACC"]=mp["ACA"]=mp["ACG"]='T';
mp["GCU"]=mp["GCC"]=mp["GCA"]=mp["GCG"]='A';
mp["UAU"]=mp["UAC"]='Y';
mp["CAU"]=mp["CAC"]='H';
mp["CAA"]=mp["CAG"]='Q';
mp["AAU"]=mp["AAC"]='N';
mp["AAA"]=mp["AAG"]='K';
mp["GAU"]=mp["GAC"]='D';
mp["GAA"]=mp["GAG"]='E';
mp["UGU"]=mp["UGC"]='C';
mp["UGG"]='W';
mp["CGU"]=mp["CGC"]=mp["CGA"]=mp["CGG"]=mp["AGA"]=mp["AGG"]='R';
mp["GGU"]=mp["GGC"]=mp["GGA"]=mp["GGG"]='G';
}
int main()
{
cin>>T;
init();
while(T--){
string s,ans;
cin>>s;
n=s.size();
for(int i=0;i+2<n;i++){
string str;
for(int j=i;j<i+3;j++)str=str+s[j];
if(str=="UAA"||str=="UAG"||str=="UGA")break;
if(mp[str]>='A'&&mp[str]<='Z')ans=mp[str]+ans,i=i+2;
}
int l=ans.size();
for(int j=l-1;j>=0;j--)cout<<ans[j];
cout<<endl;
}
// cout<<mp["CAA"]<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3368kb
input:
5 UUUUAACACUUUAUCACUUAACACCAC CAAAAUAUGAAAAAU AUGUACUUUGCGUUUCACUAA UUGCACUACUAC UACGUGGGUAUC
output:
F QNMKN MYFAFH LHYY YVGI
result:
ok 5 lines
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3300kb
input:
50 GGUCAGAGGGAGGGCCUAUUGAUACGUAGUGGACUAUCAUGUUCGUGAGCAGCAUGCAGAUUACCCGUUCGGCGAGGGAGAGCCCGCUCCGAAAUGUUUAGGGAGAUAGCGGGCCACAUAGUCGCUUGAGUGCAUACUGCGUACUUUAUGUACAAGUCCCGU AAUGGAUCACUCCUCUAUCAUUUCACUAGGUGUGACACAUGAUAUACUAACGUUCUGAAUUGGCAGUGGGGUAUGAGGCACUGAUUGGUCAUGGGACAGACUUGAGAGGAGUUGUCCUUGCUAAGCCCCGUCCC...
output:
GQREGLLIRSGLSCS NGSLLYHFTRCDT DASYKADEGLMFVLKDTGDYGSDYWQK SRKVLVDRISEPLVVAYLEGTDVDGANIGSKFDGANSSAWT FACST LTNARTSFYALRFKDACKYTCKSCSNCFRTEANSHDTQLVTAGAVGK II VLLRAARISCTFIHCRCSRRGFGPCHHALLDR TRK ESDQC QNGIPKKAC PHTRRTLPPSV GI ATSNVCTSFHGAGASGRNVCIRGRDRPL AF NPFQVSRSLQPRS IHPGYLRTGGGFRSILSVTRDGLRRHRTR...
result:
wrong answer 6th lines differ - expected: 'LTNARTSFYALRFKDACKYTCKSLFELFSNRGQFS', found: 'LTNARTSFYALRFKDACKYTCKSCSNCFRTEANSHDTQLVTAGAVGK'