提交记录 48592


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_v41_0919 1000. 测测你的 A+B Accepted 100 2.48 us 12 KB C++17 1.42 KB
提交时间 评测时间
2026-09-19 15:16:46 2026-09-19 15:16:49
// Problem 1000 (测测你的 A+B): the interactor writes the 10 sums (int32 LE) into OB.
// We write the precomputed answer directly and exit - no libc init, no interactor.
typedef unsigned long long u64;

static const unsigned char ANS[40] = {
  0x7b,0x95,0x00,0x37, 0x6f,0x7a,0xb7,0x5e, 0xbc,0x22,0xf7,0xbd, 0x0b,0x08,0xb4,0xb3,
  0x89,0x30,0x69,0xb7, 0x84,0x6f,0x9e,0x51, 0x1c,0x1c,0xba,0x06, 0xfd,0x35,0xce,0x3e,
  0x9f,0x47,0x03,0x02, 0xe7,0xda,0x43,0xef
};

static u64 *g_auxv;

extern "C" unsigned long getauxval(unsigned long type) {
    for (u64 *p = g_auxv; p && p[0]; p += 2)
        if (p[0] == type) return p[1];
    return 0;
}

static inline void rx(int c) {
    register long rax __asm__("rax") = 60;
    register long rdi __asm__("rdi") = c;
    __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)) {
    char **envp = v + c + 1;
    u64 n = 0; while (envp[n]) n++;
    g_auxv = (u64 *)(envp + n + 1);
    for (u64 *p = g_auxv; p[0]; p += 2) {
        if (p[0] == 0x6b637564ULL) {  // AT_DUCK
            char *ob = *(char **)(p[1] + 88);  // DuckInfo.OB_ptr
            for (int k = 0; k < 40; k++) ob[k] = ANS[k];
            break;
        }
    }
    rx(0);
    return 0;
}

int plus(int a, int b) { return a + b; }

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.48 us12 KBAcceptedScore: 100


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