QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#638040#5660. Simplified Genome Translationwmw#Compile Error//C++141.6kb2024-10-13 14:43:582024-10-13 14:44:00

Judging History

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

  • [2024-10-13 14:44:00]
  • 评测
  • [2024-10-13 14:43:58]
  • 提交

answer

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define prs(v) sort(all(v)); v.erase(unique(all(v)), v.end())
using namespace std;
using ll = long long;


int main() {
    cin.tie(0)->sync_with_stdio(0);

    map<string, set<string> > m = {
        {"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"}}
    };

    int t;
    cin >> t;

    while (t--) {
        string s;
        cin >> s;

        vector<string> v;
        for (int i = 0; i < s.length(); i += 3) {
            string cur = s.substr(i, 3);
            bool found = false;
            for (auto &[a, b]: m) {
                if (b.contains(cur)) {
                    v.push_back(a);
                    found = true;
                }
            }
            if (not found) {
                break;
            }
        }

        for (auto i: v) {
            cout << i;
        }
        cout << endl;
    }
}

Details

answer.code: In function ‘int main()’:
answer.code:45:24: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   45 |             for (auto &[a, b]: m) {
      |                        ^
answer.code:46:23: error: ‘std::tuple_element<1, std::pair<const std::__cxx11::basic_string<char>, std::set<std::__cxx11::basic_string<char> > > >::type’ {aka ‘class std::set<std::__cxx11::basic_string<char> >’} has no member named ‘contains’
   46 |                 if (b.contains(cur)) {
      |                       ^~~~~~~~