提交记录 47641


用户 题目 状态 得分 用时 内存 语言 代码长度
jiegec noip17b. 【NOIP2017】时间复杂度 Accepted 100 7.02 us 8 KB C 3.54 KB
提交时间 评测时间
2026-09-13 00:55:37 2026-09-13 00:55:41
// This code is AI-generated. (AI 生成的代码)
// NOIP2017 时间复杂度: parse the nested loops, detect ERR (unbalanced F/E or
// duplicate live variable) and compare the real exponent with the claimed one.
typedef unsigned long long u64;
struct DuckInfo {
    u64 abi;
    const char *in; u64 in_size;
    char *out; u64 out_limit; u64 out_size;
    char *err; u64 err_limit; u64 err_size;
    const char *ib; u64 ib_limit;
    char *ob; u64 ob_limit; u64 tsc;
} __attribute__((packed));

static const char *sk(const char *p) {
    while (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') p++;
    return p;
}
static int num(const char **pp) {
    int v = 0;
    while (**pp >= '0' && **pp <= '9') v = v * 10 + (*(*pp)++ - '0');
    return v;
}

int main(void) { return 0; }

void __libc_start_main(int (*mf)(int, char **, char **), int ac, char **av) {
    (void)mf;
    char **e = av + ac + 1;
    while (*e) e++;
    u64 *aux = (u64 *)(e + 1);
    struct DuckInfo *d = 0;
    for (; aux[0]; aux += 2)
        if (aux[0] == 0x6b637564) { d = (struct DuckInfo *)aux[1]; break; }
    const char *p = d->in;
    char *o = d->out;
    p = sk(p);
    int t = num(&p);
    struct Frame { unsigned char var, isn, isdead, contrib; } stk[128];
    while (t--) {
        p = sk(p);
        int L = num(&p);
        p = sk(p);
        /* "O(...)" */
        p++;                 /* O */
        p++;                 /* ( */
        int expw = 0;
        if (*p == 'n') {
            p++;
            if (*p == '^') { p++; expw = num(&p); }
        } else {
            p++;             /* '1' */
        }
        p++;                 /* ')' */
        unsigned char alive[256];
        for (int i = 0; i < 256; i++) alive[i] = 0;
        int top = 0, dead = 0, cur = 0, maxc = 0, err = 0;
        for (int i = 0; i < L; i++) {
            p = sk(p);
            char c = *p++;
            if (c == 'F') {
                p = sk(p);
                unsigned char var = (unsigned char)*p++;
                p = sk(p);
                int xisn = (*p == 'n');
                int xv = 0;
                if (xisn) p++; else xv = num(&p);
                p = sk(p);
                int yisn = (*p == 'n');
                int yv = 0;
                if (yisn) p++; else yv = num(&p);
                int isdead = 0, isn = 0;
                if (!xisn && yisn) isn = 1;
                else if (xisn && !yisn) isdead = 1;
                else if (!xisn && !yisn && xv > yv) isdead = 1;
                if (alive[var]) err = 1;
                alive[var] = 1;
                int contrib = isn && (dead == 0);
                stk[top].var = var; stk[top].isn = (unsigned char)isn;
                stk[top].isdead = (unsigned char)isdead; stk[top].contrib = (unsigned char)contrib;
                top++;
                if (isdead) dead++;
                if (contrib) { cur++; if (cur > maxc) maxc = cur; }
            } else {
                if (top == 0) { err = 1; }
                else {
                    top--;
                    struct Frame f = stk[top];
                    alive[f.var] = 0;
                    if (f.isdead) dead--;
                    if (f.contrib) cur--;
                }
            }
        }
        if (top) err = 1;
        if (err) { o[0]='E'; o[1]='R'; o[2]='R'; o[3]='\n'; o += 4; }
        else if (maxc == expw) { o[0]='Y'; o[1]='e'; o[2]='s'; o[3]='\n'; o += 4; }
        else { o[0]='N'; o[1]='o'; o[2]='\n'; o += 3; }
    }
    d->out_size = (u64)(o - d->out);
    __asm__ volatile("mov $60,%%eax; xor %%edi,%%edi; syscall" ::: "rax","rdi","rcx","r11","memory");
    __builtin_unreachable();
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #13.85 us8 KBAcceptedScore: 10

Testcase #23.79 us8 KBAcceptedScore: 10

Testcase #34.25 us8 KBAcceptedScore: 10

Testcase #44.26 us8 KBAcceptedScore: 10

Testcase #54.58 us8 KBAcceptedScore: 10

Testcase #63.67 us8 KBAcceptedScore: 10

Testcase #74.36 us8 KBAcceptedScore: 10

Testcase #85.47 us8 KBAcceptedScore: 10

Testcase #95.15 us8 KBAcceptedScore: 10

Testcase #107.02 us8 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2026-09-24 19:01:35 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠