QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#184008#5660. Simplified Genome Translationucup-team1209#AC ✓1ms3572kbC++201.2kb2023-09-20 10:25:192023-09-20 10:25:19

Judging History

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

  • [2023-09-20 10:25:19]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3572kb
  • [2023-09-20 10:25:19]
  • 提交

answer

#include<bits/stdc++.h>
using std::cin;
using std::cout;
std::string s[] = {"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",};
std::map<std::string, int> map;
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0);
	int name = 0;
	for(auto x : s) {
		if(x.size() != 3) {
			if(x == "STOP") {
				name = 0;
			} else {
				name = (int) x[0];
			}
		} else {
			map[x] = name;
		}
	}
	int T;
	cin >> T;
	for(int i = 0;i < T;++i) {
		std::string s, ans;
		cin >> s;
		for(int i = 0;i < (int) s.size();i += 3) {
			std::string t;
			t += s[i + 0];
			t += s[i + 1];
			t += s[i + 2];
			char c = map[t];
			if(!c) {
				break;
			} else {
				ans += c;
			}
		}
		cout << ans << '\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

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