QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#506374#5671. Programmable VirusUESTC_DECAYALI#WA 1ms3924kbC++142.0kb2024-08-05 16:59:262024-08-05 16:59:26

Judging History

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

  • [2024-08-05 16:59:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3924kb
  • [2024-08-05 16:59:26]
  • 提交

answer

#include <bits/stdc++.h>

#define STOP   ans.push_back(0);
#define NEXT   ans.push_back(1);
#define PREV   ans.push_back(2);
#define INC    ans.push_back(3);
#define DEC    ans.push_back(4);
#define IN     ans.push_back(5);
#define OUT    ans.push_back(6);
#define BEGIN  ans.push_back(7);
#define END    ans.push_back(8);
#define TRUE   -2
#define FALSE  -3
#define INPUT  -4
#define STATUS -5

int k;

int mempool[2000001], *mem = mempool + 1000000;

std::vector<int> ans;

int p = 0;
void move(int to) {
    while(p > to) p--, PREV
    while(p < to) p++, NEXT
}

void set(int val) {
    BEGIN INC END
    if(val < 0) DEC
    else while(val--) INC
}

void fork(std::function<void(int)> callback) {
    static int fork_count = 0;
    int tp = p;

    for(int i = 0; i <= 10; ++i) {
        move(tp);
        BEGIN;
            move(fork_count * 11 + (i == 10 ? -1 : i));
            INC;
            move(FALSE);
        END;
        DEC;
    }

    fork_count += 1;

    for(int i = 0; i <= 10; ++i) {
        move(fork_count * 11 + (i == 10 ? -1 : i));
        DEC;
        BEGIN;
            callback(i == 10 ? -1 : i);
            move(fork_count * 11 + (i == 10 ? -1 : i));
            INC;
        END;
    }

    fork_count -= 1;
}

void work() {
    move(INPUT);
    IN;
    fork([&](int input) {
        move(STATUS);
        fork([&](int status) {
            if(input == -1) {
                set(status == 0);
                OUT;
                STOP;
            }
            move(STATUS);
            set((status * 10 + input) % k);
        });
    });
}

const char *v[10] = {
    "CCC",
    "ACG",
    "UGA",
    "UGC",
    "UAC",
    "GCG",
    "UCC",
    "AGG",
    "UGU",
    "CAC",
};

int main() {
    std::cin >> k;
    move(TRUE);
    INC
    BEGIN
        work();
        move(TRUE);
    END
    for(auto ans: ans) std::cout << v[ans];
    std::cout << std::endl;
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3924kb

input:

1

output:

UGAUGAUGCAGGUGAUGAGCGAGGACGACGACGACGUGCUGAUGAUGAUGUUACUGAAGGACGACGACGACGACGUGCUGAUGAUGAUGAUGUUACUGAAGGACGACGACGACGACGACGUGCUGAUGAUGAUGAUGAUGUUACUGAAGGACGACGACGACGACGACGACGUGCUGAUGAUGAUGAUGAUGAUGUUACUGAAGGACGACGACGACGACGACGACGACGUGCUGAUGAUGAUGAUGAUGAUGAUGUUACUGAAGGACGACGACGACGACGACGACGACGACGUGCUGAUGA...

result:

wrong answer step out of bound