QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#725436 | #5660. Simplified Genome Translation | asd7766zxc# | AC ✓ | 0ms | 3652kb | C++20 | 3.0kb | 2024-11-08 17:46:41 | 2024-11-08 17:46:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define masterspark ios::sync_with_stdio(0), cin.tie(0),cout.tie(0),cin.exceptions(cin.failbit);
template<class F, class S> ostream &operator<<(ostream &s, pair<F, S> v) { return s << "(" << v.first << ", " << v.second << ")";}
template<class F, class S> istream &operator>>(istream &s, pair<F, S> &v) { return s >> v.first >> v.second; }
template<class T> istream &operator>>(istream &s, vector<T> &a) { for (auto &x:a) s>>x; return s; }
template<class T> ostream &operator<<(ostream &s, vector<T> &a) { int n=a.size(); if (!n) return s; s<<a[0]; for (int i=1; i<n; i++) s<<' '<<a[i]; return s; }
#define int long long
#define pp pair<int, int>
#define ff first
#define ss second
#define forr(i,n) for(int i = 1; i <= n;++i)
#define rep(i,j,n) for(int i = j; i < n;++i)
#define PB push_back
#define PF push_front
#define EB emplace_back
#define all(v) (v).begin(), (v).end()
#define FZ(x) memset(x, 0, sizeof(x)) //fill zero
#define SZ(x) ((int)x.size())
bool chmin(auto &a, auto b) { return (b < a) and (a = b, true); }
bool chmax(auto &a, auto b) { return (a < b) and (a = b, true); }
using i128 = __int128_t;
using i64 = int64_t;
using i32 = int32_t;
void solve(){
unordered_map<string, string> mp;
vector<string> vs = {
"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"
,"STOP UAA UAG UGA"
};
for (auto s : vs) {
stringstream ss(s);
string fir; ss >> fir;
string tmp;
while (ss >> tmp) mp[tmp] = fir;
}
int t; cin >>t;
for (i32 i = 0; i < t; i++) {
string s; cin >> s;
string ans = "";
for (i32 j = 0; j < s.size(); j += 3) {
string now = "";
for (i32 k = 0; k < 3; k++) now += s[j + k];
if (mp[now] == "STOP") {
break;
}
ans += mp[now];
}
cout << ans << '\n';
}
}
signed main()
{
masterspark
int t = 1;
// freopen("stdin","r",stdin);
// freopen("stdout","w",stdout);
// cin >> t;
while(t--){
solve();
}
return 0;
}
/*
/\_/\
(= ._.)
/ > \>
*/
// 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
// STOP UAA UAG UGA
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
5 UUUUAACACUUUAUCACUUAACACCAC CAAAAUAUGAAAAAU AUGUACUUUGCGUUUCACUAA UUGCACUACUAC UACGUGGGUAUC
output:
F QNMKN MYFAFH LHYY YVGI
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3652kb
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: 0ms
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