QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#147299#5660. Simplified Genome TranslationTJ_AndevikingAC ✓1ms3676kbC++201.7kb2023-08-22 23:07:032023-08-22 23:07:05

Judging History

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

  • [2023-08-22 23:07:05]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3676kb
  • [2023-08-22 23:07:03]
  • 提交

answer

#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef __int128_t int128;
typedef pair<int, int> pii;
#define iofast ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define lowbit(x) (x&(-x))
#define inv(x) qpow(x,mod-2)
#define debug(x) cout << (#x) << " = " << x << endl
#define range(x) (x).begin(), (x).end()

const int iINF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;

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

void solve()
{
    string ss;
    cin >> ss;
    int n = ss.size();
    for (int i = 0;i < n;i += 3) {
        char flag = 0;
        for (int j = 'A';j <= 'Z';++j) {
            if (s[j].find(ss.substr(i, 3)) != string::npos) {
                flag = j;
                break;
            }
        }
        if (flag)
            cout << flag;
        else
            break;
    }

    cout << '\n';
}

/*---------------------------------------*/

int main()
{
    iofast;
    int t = 1;
    cin >> t;
    init();
    while (t--)
        solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3652kb

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

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

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