QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#219252#5660. Simplified Genome TranslationJenniferLing#AC ✓1ms3892kbC++172.0kb2023-10-19 10:12:282023-10-19 10:12:29

Judging History

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

  • [2023-10-19 10:12:29]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3892kb
  • [2023-10-19 10:12:28]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long

map<string, char> mp;

void build(string a, char b) {
  mp[a] = b;
}

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

void solve() {
  string s; cin >> s;
  string res = "";
  bool flag = 1;
  int n = (int)s.size();
  for (int i = 0; i < n && flag; i += 3) {
    string t = s.substr(i, 3);
    if (mp[t] == '$') {
      flag = 0;
    } else {
      res.push_back(mp[t]);
    }
  }
  cout << res << "\n";
}

signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  init();
  cin >> T;
  while (T--) solve();
}

詳細信息

Test #1:

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

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

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

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