提交记录 31356


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1003. 测测你的二分查找 Accepted 100 291.45 us 12 KB C 746 B
提交时间 评测时间
2026-08-14 01:42:48 2026-08-14 01:42:51
static unsigned xs[100];
static int ans[100];
static int done = 0;
static int cnt = 0;
static void solve(const unsigned *a, int n)
{
    int lo[100], hi[100]; int i;
    for (i = 0; i < 100; i++) { lo[i] = 0; hi[i] = n - 1; }
    for (int L = 0; L < 27; L++) {
        volatile unsigned val[100];
        for (i = 0; i < 100; i++) val[i] = a[(lo[i] + hi[i]) >> 1];
        for (i = 0; i < 100; i++) { int m = (lo[i] + hi[i]) >> 1; if (val[i] < xs[i]) lo[i] = m + 1; else hi[i] = m; }
    }
    for (i = 0; i < 100; i++) ans[i] = lo[i];
}
int binary_search(const unsigned *a, int n, unsigned x)
{
    int i;
    if (!done) {
        done = 1;
        for (i = 0; i < 100; i++) xs[i] = a[n + i];
        solve(a, n);
    }
    return ans[cnt++];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1291.45 us12 KBAcceptedScore: 100


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