QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#626736#5660. Simplified Genome TranslationKowerKoint#Compile Error//C++141.3kb2024-10-10 12:15:442024-10-10 12:15:49

Judging History

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

  • [2024-10-10 12:15:49]
  • 评测
  • [2024-10-10 12:15:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    map<char, string> mp;
    mp['F'] = "UUUUUC";
    mp['L'] = "UUAUUGCUUCUCCUACUG";
    mp['I'] = "AUUAUCAUA";
    mp['M'] = "AUG";
    mp['V'] = "GUUGUCGUAGUG";
    mp['S'] = "UCUUCCUCAUCGAGUAGC";
    mp['P'] = "CCUCCCCCACCG";
    mp['T'] = "ACUACCACAACG";
    mp['A'] = "GCUGCCGCAGCG";
    mp['Y'] = "UAUUAC";
    mp['H'] = "CAUCAC";
    mp['Q'] = "CAACAG";
    mp['N'] = "AAUAAC";
    mp['K'] = "AAAAAG";
    mp['D'] = "GAUGAC";
    mp['E'] = "GAAGAG";
    mp['C'] = "UGUUGC";
    mp['W'] = "UGG";
    mp['R'] = "CGUCGCCGACGGAGAAGG";
    mp['G'] = "GGUGGCGGAGGG";
    mp['$'] = "UAAUAGUGA";
    map<string, char> rmp;
    for(auto [k, v] : mp) {
        assert(ssize(v)%3 == 0);
        for(int i = 0; i < ssize(v); i += 3) {
            string vv = v.substr(i, 3);
            assert(!rmp.count(vv));
            rmp[vv]= k;
        }
    }
    int t; cin >> t;
    while(t--) {
        string s; cin >> s;
        string t;
        for(int i = 0; i < ssize(s); i += 3) {
            string ss = s.substr(i, 3);
            assert(rmp.count(ss));
            t += rmp[ss];
            if(t.back() == '$') {
                t.pop_back();
                break;
            }
        }
        cout << t << '\n';
    }
}

Details

answer.code: In function ‘int main()’:
answer.code:29:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   29 |     for(auto [k, v] : mp) {
      |              ^
In file included from /usr/include/c++/13/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:106,
                 from answer.code:1:
answer.code:30:16: error: ‘ssize’ was not declared in this scope; did you mean ‘ssize_t’?
   30 |         assert(ssize(v)%3 == 0);
      |                ^~~~~
answer.code:41:28: error: ‘ssize’ was not declared in this scope; did you mean ‘ssize_t’?
   41 |         for(int i = 0; i < ssize(s); i += 3) {
      |                            ^~~~~
      |                            ssize_t