QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#225261#5660. Simplified Genome TranslationBUET_Twilight#AC ✓1ms3760kbC++233.2kb2023-10-24 12:43:312023-10-24 12:43:31

Judging History

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

  • [2023-10-24 12:43:31]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3760kb
  • [2023-10-24 12:43:31]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
#define int long long
#define ll long long 
#define lll __int128_t
#define pb push_back
// #define double long double
#define pii pair<int,int>
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;
typedef pair<double, double> pdd;
const double EPS = 1e-12;


map<string,char> amino;

void prep(){

    /*
F UUU UUC
L UUA UUG CUU CUC CUA CUG
I AUU AUC AUA
M AUG
V GUU GUC GUA GUG
S UCU UCC UCA UCG AGU AGC
P CCU CCC CCA CCG
T ACU ACC ACA ACG
A GCU GCC GCA GCG
Y UAU UAC
H CAU CAC
Q CAA CAG
N AAU AAC
K AAA AAG
D GAU GAC
E GAA GAG
C UGU UGC
W UGG
R CGU CGC CGA CGG AGA AGG
G GGU GGC GGA GGG
    */
    amino["UUU"] = 'F';
    amino["UUC"] = 'F';
    amino["UUA"] = 'L';
    amino["UUG"] = 'L';
    amino["CUU"] = 'L';
    amino["CUC"] = 'L';
    amino["CUA"] = 'L';
    amino["CUG"] = 'L';
    amino["AUU"] = 'I';
    amino["AUC"] = 'I';
    amino["AUA"] = 'I';
    amino["AUG"] = 'M';
    amino["GUU"] = 'V';
    amino["GUC"] = 'V';
    amino["GUA"] = 'V';
    amino["GUG"] = 'V';
    amino["UCU"] = 'S';
    amino["UCC"] = 'S';
    amino["UCA"] = 'S';
    amino["UCG"] = 'S';
    amino["AGU"] = 'S';
    amino["AGC"] = 'S';
    amino["CCU"] = 'P';
    amino["CCC"] = 'P';
    amino["CCA"] = 'P';
    amino["CCG"] = 'P';
    amino["ACU"] = 'T';
    amino["ACC"] = 'T';
    amino["ACA"] = 'T';
    amino["ACG"] = 'T';
    amino["GCU"] = 'A';
    amino["GCC"] = 'A';
    amino["GCA"] = 'A';
    amino["GCG"] = 'A';
    amino["UAU"] = 'Y';
    amino["UAC"] = 'Y';
    amino["CAU"] = 'H';
    amino["CAC"] = 'H';
    amino["CAA"] = 'Q';
    amino["CAG"] = 'Q';
    amino["AAU"] = 'N';
    amino["AAC"] = 'N';
    amino["AAA"] = 'K';
    amino["AAG"] = 'K';
    amino["GAU"] = 'D';
    amino["GAC"] = 'D';
    amino["GAA"] = 'E';
    amino["GAG"] = 'E';
    amino["UGU"] = 'C';
    amino["UGC"] = 'C';
    amino["UGG"] = 'W';
    amino["CGU"] = 'R';
    amino["CGC"] = 'R';
    amino["CGA"] = 'R';
    amino["CGG"] = 'R';
    amino["AGA"] = 'R';
    amino["AGG"] = 'R';
    amino["GGU"] = 'G';
    amino["GGC"] = 'G';
    amino["GGA"] = 'G';
    amino["GGG"] = 'G';

}
void solve(){
    string s;
    cin>>s;
    int n = s.size();
    string ans = "";
    for(int i=2;i<n;i+=3){
        string codon = s.substr(i-2,3);
       // cout<<codon<<endl;
        if( codon == "UAA" or codon == "UAG" or codon == "UGA" ){
            break;
        }
        ans += amino[codon];
    }
    cout<<ans<<endl;
}
signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    prep();
    int tc;
    cin>>tc;
    while(tc--) solve();
    
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3660kb

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: 3744kb

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: 1ms
memory: 3760kb

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