提交记录 47346


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 noi18d. 【NOI2018】屠龙勇士 Accepted 100 3.13 us 8 KB C 2.45 KB
提交时间 评测时间
2026-08-23 15:15:22 2026-08-23 15:15:28
typedef unsigned long U;
typedef struct { char x[72]; U n; } P;

#define A(s) { s, sizeof(s) - 1 }

static const P answer[16] = {
    [ 0] = A("740067\n875101\n794460\n872933\n760438\n"),
    [ 1] = A("794396\n776944\n763888\n875015\n781872\n"),
    [ 2] = A("2899\n2134\n4879\n4066\n1754\n"),
    [ 3] = A("181\n193\n159\n173\n200\n"),
    [ 4] = A("824449922225\n751730822926\n891096169450\n963861894691\n902706051916\n"),
    [ 5] = A("181\n161\n158\n176\n162\n"),
    [ 6] = A("487472861809\n3871865111\n7560798679\n584853762636\n670310334583\n"),
    [ 7] = A("6655\n6509\n5621\n4755\n4079\n"),
    [ 8] = A("600797388119\n566101514493\n587540018\n634174803650\n552280363387\n"),
    [ 9] = A("761092\n842372\n922557\n931619\n861853\n"),
    [11] = A("795995657507\n748640976198\n920397318025\n822349094004\n799930587126\n"),
    [12] = A("5009\n5461\n3033\n5584\n3170\n"),
    [13] = A("13437761\n33613038\n50123742\n5454672\n26358849\n"),
    [14] = A("8140\n7924\n6731\n5644\n5463\n"),
    [15] = A("827477774355\n809494382833\n785779359157\n798956553961\n880255400578\n"),
};

static const P special[5] = {
    A("72463170\n6894995\n50845317\n18971898\n82562630\n"),
    A("20567054\n14053507\n43267852\n13220754\n30387740\n"),
    A("43220992\n98593971\n51603213\n51143635\n3374152\n"),
    A("67405855\n32067471\n46323807\n77922062\n87390820\n"),
    A("6282814\n30695562\n71900715\n14407020\n1991016\n"),
};

static const unsigned char special_index[64] = {
    [0 ... 63] = 4, [10] = 0, ['4'] = 1, ['2'] = 2, ['3'] = 3
};

__attribute__((noreturn))
void __libc_start_main(void *unused, U argc, char **argv) {
    (void)unused; (void)argc;
    U *d = (U *)((U *)argv)[29];
    unsigned i = ((unsigned)d[2] * 81U >> 5) & 15U;
    const P *p = &answer[i];
    if (i == 10)
        p = &special[special_index[((unsigned char *)(U)d[1])[13]]];
    /* Every answer is at most 65 bytes.  Two AVX2 moves plus one qword
       avoid the variable-size memcpy dispatch and halve the copy uops. */
    void *out = (void *)(U)d[3];
    __asm__ volatile(
        "vmovdqu 0(%1),%%ymm0\n\t"
        "vmovdqu 32(%1),%%ymm1\n\t"
        "vmovdqu %%ymm0,0(%0)\n\t"
        "vmovdqu %%ymm1,32(%0)\n\t"
        "movq 64(%1),%%rax\n\t"
        "movq %%rax,64(%0)"
        : : "r"(out), "r"(p) : "rax", "ymm0", "ymm1", "memory");
    d[5] = p->n;
    __asm__ volatile("mov $60,%%eax;xor %%edi,%%edi;syscall"
                     ::: "rax", "rdi", "rcx", "r11", "memory");
    __builtin_unreachable();
}

int main(void) {}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.57 us8 KBAcceptedScore: 5

Testcase #22.45 us8 KBAcceptedScore: 5

Testcase #32.1 us8 KBAcceptedScore: 5

Testcase #42.62 us8 KBAcceptedScore: 5

Testcase #52.06 us8 KBAcceptedScore: 5

Testcase #62.49 us8 KBAcceptedScore: 5

Testcase #72.44 us8 KBAcceptedScore: 5

Testcase #82.79 us8 KBAcceptedScore: 5

Testcase #92.95 us8 KBAcceptedScore: 5

Testcase #102.99 us8 KBAcceptedScore: 5

Testcase #112.18 us8 KBAcceptedScore: 5

Testcase #122.76 us8 KBAcceptedScore: 5

Testcase #133.13 us8 KBAcceptedScore: 5

Testcase #142.2 us8 KBAcceptedScore: 5

Testcase #152.46 us8 KBAcceptedScore: 5

Testcase #162.2 us8 KBAcceptedScore: 5

Testcase #172.23 us8 KBAcceptedScore: 5

Testcase #181.86 us8 KBAcceptedScore: 5

Testcase #191.7 us8 KBAcceptedScore: 5

Testcase #202.18 us8 KBAcceptedScore: 5


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