QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#680508 | #5660. Simplified Genome Translation | Kdlyh# | AC ✓ | 1ms | 3668kb | C++20 | 1.9kb | 2024-10-26 21:18:49 | 2024-10-26 21:18:50 |
Judging History
answer
#include<bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(...) 42
#endif
using i64 = long long;
#define int long long
namespace ranges = std::ranges;
std::array<std::set<std::string>, 26> _decode;
auto& decode(char c) {return _decode[c - 'A'];}
void split(const std::string str) {
std::istringstream iss(str);
std::string word; bool begin{true};
char ch{};
while (iss >> word) {
if (begin) {
ch = word.front(); begin = false;
} else {
decode(ch).insert(word);
}
}
return ;
}
void pre_cal()
{
split("F UUU UUC");
split("L UUA UUG CUU CUC CUA CUG");
split("I AUU AUC AUA");
split("M AUG");
split("V GUU GUC GUA GUG");
split("S UCU UCC UCA UCG AGU AGC");
split("P CCU CCC CCA CCG");
split("T ACU ACC ACA ACG");
split("A GCU GCC GCA GCG");
split("Y UAU UAC");
split("H CAU CAC");
split("Q CAA CAG");
split("N AAU AAC");
split("K AAA AAG");
split("D GAU GAC");
split("E GAA GAG");
split("C UGU UGC");
split("W UGG");
split("R CGU CGC CGA CGG AGA AGG");
split("G GGU GGC GGA GGG");
}
void solve()
{
#define tests
std::string s; std::cin >> s; int n{std::ssize(s)};
std::string res;
for (int i = 0; i + 2 < n; i += 3) {
auto now{s.substr(i, 3)};
for (auto& stop : {"UAA", "UAG", "UGA"}) if (now == stop) {
std::cout << res << "\n"; return ;
}
for (int i = 0; i < 26; i++) {
if (decode(i + 'A').contains(now)) {
res.push_back(char(i + 'A'));
}
}
}
std::cout << res << "\n"; return ;
}
signed main()
{
std::cin.tie(nullptr)->sync_with_stdio(false);
pre_cal();
int _(1);
#ifdef tests
std::cin >> _;
#endif
while(_--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
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: 3584kb
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: 3608kb
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