QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519735#5671. Programmable Virusucup-team1198#AC ✓0ms3840kbC++204.5kb2024-08-15 00:49:232024-08-15 00:49:23

Judging History

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

  • [2024-08-15 00:49:23]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3840kb
  • [2024-08-15 00:49:23]
  • 提交

answer

#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

/*
CCC 0 STOP
ACG 1 NEXT
UGA 2 PREV
UGC 3 INC
UAC 4 DEC
GCG 5 OUT
UCC 6 IN
AGG 7 BEGIN
UGU 8 END
CAC 9 (DEBUG)
*/

  vector<string> codes = {"STOP", "NEXT", "PREV", "INC", "DEC", "OUT", "IN", "BEGIN", "END", "DEBUG"};
  vector<string> nucl = {"CCC", "ACG", "UGA", "UGC", "UAC", "GCG", "UCC", "AGG", "UGU", "CAC"};
  map<string, int> to_id;
  for (int i = 0; i < 10; ++i)
    to_id[codes[i]] = i;

  auto op = [&](string s) {
    if (!to_id.count(s))
      assert(false);
    return to_id[s];
  };

  auto case_digits = [&](vector<vector<int>> to_do) {
    vector<int> ans;
    ans.emplace_back(op("BEGIN"));
    for (int i = 0; i < 8; ++i) {
      ans.emplace_back(op("DEC"));
      ans.emplace_back(op("BEGIN"));
    }
    for (int i = 9; i >= 0; --i) {
      for (int x : to_do[i])
        ans.emplace_back(x);
      ans.emplace_back(op("END"));
    }
    ans.pop_back();
    return ans;
  };
  
  int k;
  cin >> k;
  if (k == 1) {
    cout << "UCCAGGUACUGUUGCGCGCCC";
  } else if (k == 2) {
    cout << "UGCAGGUACACGAGGUACUGUUGAAGGUACACGUGCUGAUGUUCCUGCUGUACGUGCAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGUGUUGUUGUUGUUGUUGUUGUUGUUGUUGUUGAGCGCCC";
  } else if (k == 3) {
    cout << "UGCAGGACGACGUCCAGGUACACGUGCACGUGCUGAUGAUGUACGACGACGUGCUGAUGCAGGUACACGAGGUACUGUUGAUGUACGAGGUGAUGAUGAUGCUGAAGGUACACGAGGUACUGUUGAUGUACGGCGCCCUGUUGAUGAAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGUGUUGUUGUUGUUGUUGUUGUUGUUGUUGAAGGUACUGAUGCACGUGUUGAAGGUACACGUGCUGAAGGUACACGUGCUGAAGGUACACGUACUACUGAAGGUACACGUGCUGAUGUUGUUGUUGUACGAGGUACUGAUGCACGUGUUGAUGAUGU";
  } else if (k == 4) {
    vector<int> ans = {op("INC"), op("BEGIN"), op("NEXT"), op("IN"), op("INC"), op("END"), op("PREV"), op("DEC")};
    vector<int> win = {op("NEXT"), op("NEXT"), op("INC"), op("OUT"), op("STOP")};
    vector<int> lose = {op("NEXT"), op("NEXT"), op("OUT"), op("STOP")};
    vector<vector<int>> to_do(10);
    for (int i = 0; i < 10; ++i) {
      vector<int> cur = {op("PREV"), op("DEC")};
      vector<vector<int>> cur_to_do(10);
      for (int j = 0; j < 10; ++j) {
        if ((j * 10 + i) % 4 == 0)
          cur_to_do[j] = win;
        else
          cur_to_do[j] = lose;
      }
      auto cur_rest = case_digits(cur_to_do);
      for (int x : cur_rest)
        cur.emplace_back(x);
      to_do[i] = cur;
    }
    auto rest = case_digits(to_do);
    for (int x : rest)
      ans.emplace_back(x);
    for (int i : ans)
      cout << nucl[i];
  } else if (k == 5) {
    vector<int> ans = {op("IN"), op("INC"), op("BEGIN"), op("NEXT"), op("IN"), op("INC"), op("END"), op("PREV"), op("DEC")};
    vector<int> win = {op("NEXT"), op("INC"), op("OUT"), op("STOP")};
    vector<int> lose = {op("NEXT"), op("OUT"), op("STOP")};
    vector<vector<int>> to_do(10);
    for (int i = 0; i < 10; ++i) {
      if (i % 5 == 0)
        to_do[i] = win;
      else
        to_do[i] = lose;
    }
    auto rest = case_digits(to_do);
    for (int x : rest)
      ans.emplace_back(x);
    for (int i : ans)
      cout << nucl[i];
  } else {
    cout << "UGCAGGACGACGUCCAGGUACACGUGCACGUGCUGAUGAUGUACGACGACGUGCUGAUGCAGGUACACGAGGUACUGUUGAUGUACGAGGUGAUGAUGAUGAAGGAGGUACUGUGCGCCCUGUACGACGACGACGACGACGUGCAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGUGUUGUUGUUGUUGUUGUUGUUGUUGUUGUUGAGCGCCCUGUUGAACGACGAGGUACUGUACGAGGUACUGUUGAUGAUGAUGAAGGUACACGACGACGUGCACGUGCUGAUGAUGAUGAUGUACGACGACGAGGUACUGAUGAUGAUGCACGACGACGUGUUGAUGAUGAAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGUGUUGUUGUUGUUGUUGUUGUUGUUGUUGAAGGUACUGAUGCACGUGUUGAAGGUACACGUGCUGAAGGUACACGUGCUGAAGGUACACGUACUACUGAAGGUACACGUGCUGAUGUUGUUGUUGUACGAGGUACUGAUGCACGUGUUGAUGAUGU";
  }
  cout << '\n';

  /*int n;
  cin >> n;
  cout << n << '\n';*/
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3800kb

input:

1

output:

UCCAGGUACUGUUGCGCGCCC

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2

output:

UGCAGGUACACGAGGUACUGUUGAAGGUACACGUGCUGAUGUUCCUGCUGUACGUGCAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGUGUUGUUGUUGUUGUUGUUGUUGUUGUUGUUGAGCGCCC

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

3

output:

UGCAGGACGACGUCCAGGUACACGUGCACGUGCUGAUGAUGUACGACGACGUGCUGAUGCAGGUACACGAGGUACUGUUGAUGUACGAGGUGAUGAUGAUGCUGAAGGUACACGAGGUACUGUUGAUGUACGGCGCCCUGUUGAUGAAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGUGUUGUUGU...

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

6

output:

UGCAGGACGACGUCCAGGUACACGUGCACGUGCUGAUGAUGUACGACGACGUGCUGAUGCAGGUACACGAGGUACUGUUGAUGUACGAGGUGAUGAUGAUGAAGGAGGUACUGUGCGCCCUGUACGACGACGACGACGACGUGCAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGUGUUGU...

result:

ok correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

1

output:

UCCAGGUACUGUUGCGCGCCC

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

2

output:

UGCAGGUACACGAGGUACUGUUGAAGGUACACGUGCUGAUGUUCCUGCUGUACGUGCAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGUGUUGUUGUUGUUGUUGUUGUUGUUGUUGUUGAGCGCCC

result:

ok correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

3

output:

UGCAGGACGACGUCCAGGUACACGUGCACGUGCUGAUGAUGUACGACGACGUGCUGAUGCAGGUACACGAGGUACUGUUGAUGUACGAGGUGAUGAUGAUGCUGAAGGUACACGAGGUACUGUUGAUGUACGGCGCCCUGUUGAUGAAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGAGGUACUGAUGCACGAGGUACUGAUGCACGAGGUACUGAUACUACACGUGUUGUUGU...

result:

ok correct

Test #8:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

4

output:

UGCAGGACGUCCUGCUGUUGAUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUGAUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUACGACGGCGCCCUGUUGAUACAGGUACAGGUAC...

result:

ok correct

Test #9:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

5

output:

UCCUGCAGGACGUCCUGCUGUUGAUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGUACAGGACGGCGCCCUGUACGGCGCCCUGUACGGCGCCCUGUACGGCGCCCUGUACGUGCGCGCCCUGUACGGCGCCCUGUACGGCGCCCUGUACGGCGCCCUGUACGGCGCCCUGUACGUGCGCGCCC

result:

ok correct

Test #10:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

6

output:

UGCAGGACGACGUCCAGGUACACGUGCACGUGCUGAUGAUGUACGACGACGUGCUGAUGCAGGUACACGAGGUACUGUUGAUGUACGAGGUGAUGAUGAUGAAGGAGGUACUGUGCGCCCUGUACGACGACGACGACGACGUGCAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGAGGUACUGAUGCACGAGGUACUGAUACACGUGUUGU...

result:

ok correct