QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261672#5660. Simplified Genome TranslationhazeAC ✓1ms3736kbC++141.8kb2023-11-23 08:16:492023-11-23 08:16:50

Judging History

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

  • [2023-11-23 08:16:50]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3736kb
  • [2023-11-23 08:16:49]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define irep(i, l, r) for(int i = (l); i <= (r); ++ i)
#define drep(i, r, l) for(int i = (r); i >= (l); -- i)
const int N = 500009;
const int mod = 1000000000 + 7;
map<string, string>f = {{"UUU","F"},{"UUC","F"},{"UUA","L"},{"UUG","L"},{"CUU","L"},{"CUC","L"},{"CUA","L"},{"CUG","L"},{"AUU","I"},{"AUC","I"},{"AUA","I"},{"AUG","M"},{"GUU","V"},{"GUC","V"},{"GUA","V"},{"GUG","V"},{"UCU","S"},{"UCC","S"},{"UCA","S"},{"UCG","S"},{"AGU","S"},{"AGC","S"},{"CCU","P"},{"CCC","P"},{"CCA","P"},{"CCG","P"},{"ACU","T"},{"ACC","T"},{"ACA","T"},{"ACG","T"},{"GCU","A"},{"GCC","A"},{"GCA","A"},{"GCG","A"},{"UAU","Y"},{"UAC","Y"},{"CAU","H"},{"CAC","H"},{"CAA","Q"},{"CAG","Q"},{"AAU","N"},{"AAC","N"},{"AAA","K"},{"AAG","K"},{"GAU","D"},{"GAC","D"},{"GAA","E"},{"GAG","E"},{"UGU","C"},{"UGC","C"},{"UGG","W"},{"CGU","R"},{"CGC","R"},{"CGA","R"},{"CGG","R"},{"AGA","R"},{"AGG","R"},{"GGU","G"},{"GGC","G"},{"GGA","G"},{"GGG","G"},{"UAA","STOP"},{"UAG","STOP"},{"UGA","STOP"}};
inline ll read(){
	ll s = 0;
	bool w = 0;
	char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-')w = 1;
		ch = getchar();
	}
	while(isdigit(ch)){
		s *= 10, s += (ch ^ 48);
		ch = getchar();
	}
	return w ? - s : s;
}

int main(){
	int T = read();
	while(T --){
		string s;
		cin >> s;
		int n = s.length();
		for(int i = 0; i < n; i += 3){
			string t = "";
			t += s[i], t += s[i + 1], t += s[i + 2];
			if(f[t] == "STOP")break;
			else cout << f[t];
		}
		putchar('\n');
	}
}

/*
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: 3532kb

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

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

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