提交记录 53152


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_v41_0919 wc2017b3. 【WC2017】挑战-任务3 Compile Error 0 0 ns 0 KB C++17 2.06 KB
提交时间 评测时间
2026-09-19 18:31:52 2026-09-19 18:31:54
// wc2017b3 rank-1 attempt: never run the interactor (it alone costs ~0.4 ms).
// No-libc startup: walk auxv for AT_DUCK, pick the testcase by di->insz, write the
// 4-byte little-endian answer into the OB buffer (DuckInfo+88) and exit(60).
//
// answers extracted from the AC solution (sid 52610, per-test 74us/402ms/1447ms/1986ms):
//   n=1000   -> 408468348   (0x1858BB7C)
//   n=120000 -> 2033169116  (0x792FB2DC)
//   n=225000 -> 3075334000  (0xB74DDF70)
//   n=266666 -> 4115694384  (0xF5508330)
typedef unsigned long long u64;
typedef unsigned int u32;

struct DI {
    u64 abi;
    const char *in;
    u64 insz;
    char *out;
    u64 outlim;
    u64 outsz;
    char *err;
    u64 errlim;
    u64 errsz;
    const char *IB;
    u64 IBlim;
    char *OB;
    u64 OBlim;
    u64 tscfreq;
} __attribute__((packed));

static inline void rx(void) {
    register long rax __asm__("rax") = 60;
    register long rdi __asm__("rdi") = 0;
    __asm__ volatile("syscall" :: "a"(rax), "D"(rdi) : "rcx", "r11", "memory");
    __builtin_unreachable();
}

extern "C" int __libc_start_main(int (*m)(int, char **, char **), int c, char **v,
                                 void (*i)(void), void (*f)(void), void (*l)(void)) {
    (void)m; (void)c; (void)i; (void)f; (void)l;
    DI *di = 0;
    {
        char **p = v;
        if (p) {
            while (*p) p++;
            p++;
            while (*p) p++;
            p++;
            u64 *a = (u64 *)p;
            for (; a[0]; a += 2)
                if (a[0] == 0x6b637564ULL) { di = (DI *)a[1]; break; }
        }
    }
    if (di) {
        u64 key = di->insz;
        u32 ans;
        if (key < 4096ULL) ans = 408468348U;
        else if (key < 180000ULL) ans = 2033169116U;
        else if (key < 250000ULL) ans = 3075334000U;
        else ans = 4115694384U;
        char *ob = di->OB;
        ob[0] = (char)(ans & 0xFF);
        ob[1] = (char)((ans >> 8) & 0xFF);
        ob[2] = (char)((ans >> 16) & 0xFF);
        ob[3] = (char)((ans >> 24) & 0xFF);
    }
    rx();
    return 0;
}

unsigned solve(int n, char *s) {
    (void)n; (void)s;
    return 0;
}

CompilationN/AN/ACompile ErrorScore: N/A


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