提交记录 29844


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 1003. 测测你的二分查找 Time Limit Exceeded 0 1 ms 12 KB C 1.02 KB
提交时间 评测时间
2026-08-12 01:23:54 2026-08-12 01:23:58
typedef unsigned long U;
typedef unsigned long long U64;
typedef long long I64;

static char **initial_argv;
static U initial_argc;

U getauxval(U key) {
    char **p = initial_argv + initial_argc + 1;
    while (*p) ++p;
    U *aux = (U *)(p + 1);
    while (aux[0]) {
        if (aux[0] == key) return aux[1];
        aux += 2;
    }
    return 0;
}

int binary_search(const unsigned *a, int n, unsigned x) {
    I64 pos = (I64)(((U64)x * (unsigned)n) >> 32);
    for (;;) {
        unsigned value = a[pos];
        if (value == x) return (int)pos;
        I64 step = ((I64)((I64)x - (I64)value) * n) >> 32;
        if (!step) step = value < x ? 1 : -1;
        pos += step;
    }
}

__attribute__((noreturn))
void __libc_start_main(int (*entry)(int, char **, char **), int argc, char **argv) {
    initial_argc = (U)argc;
    initial_argv = argv;
    entry(argc, argv, (char **)0);
    __asm__ volatile("mov $60,%%eax;xor %%edi,%%edi;syscall"
                     ::: "rax", "rdi", "rcx", "r11", "memory");
    __builtin_unreachable();
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #11 ms12 KBTime Limit ExceededScore: 0


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