QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#97406#5660. Simplified Genome Translationaguo123AC ✓4ms3364kbC++111.6kb2023-04-16 18:37:282023-04-16 18:37:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-16 18:37:29]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3364kb
  • [2023-04-16 18:37:28]
  • 提交

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["CUG"]='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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3364kb

input:

5
UUUUAACACUUUAUCACUUAACACCAC
CAAAAUAUGAAAAAU
AUGUACUUUGCGUUUCACUAA
UUGCACUACUAC
UACGUGGGUAUC

output:

F
QNMKN
MYFAFH
LHYY
YVGI

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 4ms
memory: 3300kb

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: 3ms
memory: 3296kb

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