QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#84823 | #5660. Simplified Genome Translation | piasticOuO# | WA | 2ms | 3368kb | C++14 | 2.5kb | 2023-03-06 19:44:02 | 2023-03-06 19:44:06 |
Judging History
answer
#include <iostream>
using namespace std;
char s[500];
int sum[500];
int T;
char dz[5] = {' ', 'A', 'U', 'G', 'C'};
int dzb[40][10];
char chb[40] = {' ', 'F', 'L', 'I', 'M', 'V', 'S', 'P', 'T', 'A', 'Y', 'H', 'Q', 'N', 'K', 'D', 'E', 'C', 'W', 'R', 'G', 0};
int numDz[40];
void init() {
dzb[1][1] = 222, dzb[1][2] = 224;
numDz[1] = 2;
dzb[2][1] = 221, dzb[2][2] = 223, dzb[2][3] = 422, dzb[2][4] = 424, dzb[2][5] = 421, dzb[2][6] = 423;
numDz[2] = 6;
dzb[3][1] = 122, dzb[3][2] = 124, dzb[3][3] = 121;
numDz[3] = 3;
dzb[4][1] = 123;
numDz[4] = 1;
dzb[5][1] = 322, dzb[5][2] = 324, dzb[5][3] = 321, dzb[5][4] = 323;
numDz[5] = 4;
dzb[6][1] = 242, dzb[6][2] = 244, dzb[6][3] = 241, dzb[6][4] = 243, dzb[6][5] = 132, dzb[6][6] = 134;
numDz[6] = 6;
dzb[7][1] = 442, dzb[7][2] = 444, dzb[7][3] = 441, dzb[7][4] = 443;
numDz[7] = 4;
dzb[8][1] = 141, dzb[8][2] = 142, dzb[8][3] = 143, dzb[8][4] = 144;
numDz[8] = 4;
dzb[9][1] = 341, dzb[9][2] = 342, dzb[9][3] = 343, dzb[9][4] = 344;
numDz[9] = 4;
dzb[10][1] = 212, dzb[10][2] = 214;
numDz[10] = 2;
dzb[11][1] = 412, dzb[11][2] = 414;
numDz[11] = 2;
dzb[12][1] = 411, dzb[12][2] = 413;
numDz[12] = 2;
dzb[13][1] = 112, dzb[13][2] = 114;
numDz[13] = 2;
dzb[14][1] = 111, dzb[14][2] = 113;
numDz[14] = 2;
dzb[15][1] = 312, dzb[15][2] = 314;
numDz[15] = 2;
dzb[16][1] = 311, dzb[16][2] = 313;
numDz[16] = 2;
dzb[17][1] = 232, dzb[17][2] = 234;
numDz[17] = 2;
dzb[18][1] = 233;
numDz[18] = 1;
dzb[19][1] = 431, dzb[19][2] = 432, dzb[19][3] = 433, dzb[19][4] = 434, dzb[19][5] = 131, dzb[19][6] = 133;
numDz[19] = 6;
dzb[20][1] = 331, dzb[20][2] = 332, dzb[20][3] = 333, dzb[20][4] = 334;
numDz[20] = 4;
dzb[21][1] = 211, dzb[21][2] = 213, dzb[21][3] = 231;
numDz[20] = 3;
}
int trans(char x) {
for (int i = 1; i <= 4; ++i) {
if (x == dz[i]) {
return i;
}
}
return 0;
}
char find(int x) {
for (int i = 1; i <= 21; ++i) {
for (int j = 1; j <= numDz[i]; ++j) {
if (x == dzb[i][j]) {
return chb[i];
}
}
}
return 0;
}
void solve() {
cin >> (s + 1);
int len = 0;
for (int i = 1; s[i]; ++i) {
sum[i] = trans(s[i]);
len ++;
}
for (int i = 1; i <= len; i += 3) {
int x = sum[i] * 100 + sum[i + 1] * 10 + sum[i + 2];
char u = find(x);
if (u == 0)
break;
cout << u;
}
cout << '\n';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
init();
cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3344kb
input:
5 UUUUAACACUUUAUCACUUAACACCAC CAAAAUAUGAAAAAU AUGUACUUUGCGUUUCACUAA UUGCACUACUAC UACGUGGGUAUC
output:
F QNMKN MYFAFH LHYY YVGI
result:
ok 5 lines
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3368kb
input:
50 GGUCAGAGGGAGGGCCUAUUGAUACGUAGUGGACUAUCAUGUUCGUGAGCAGCAUGCAGAUUACCCGUUCGGCGAGGGAGAGCCCGCUCCGAAAUGUUUAGGGAGAUAGCGGGCCACAUAGUCGCUUGAGUGCAUACUGCGUACUUUAUGUACAAGUCCCGU AAUGGAUCACUCCUCUAUCAUUUCACUAGGUGUGACACAUGAUAUACUAACGUUCUGAAUUGGCAGUGGGGUAUGAGGCACUGAUUGGUCAUGGGACAGACUUGAGAGGAGUUGUCCUUGCUAAGCCCCGUCCC...
output:
GQRE NGSLLYHFTRCDT AGRC DASYKADEGLMFVLKDTGDYGSDYWQK CLYSILRGPYVQYDYLM SRKVLVDRISEPLVVAYLEGTDVD YTIVV FACST LFPSRR LTNARTSFYALRFKDACKYTCKSLFELFSNR II PPRSS VLLRAARISCTFIHCRCSRR TRKLSFS PEG ESDQC QNGIPKKAC PHTRRTLPPSV GI ATSNVCTSFHGAGASGRNVCIRGRDRPL FGKLCEVT AF SIDVWRV NPFQVSRSLQPRS EEWRVS IHPGYLRT D...
result:
wrong answer 1st lines differ - expected: 'GQREGLLIRSGLSCS', found: 'GQRE'