提交记录 32437


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1003. 测测你的二分查找 Accepted 100 295.55 us 12 KB C 760 B
提交时间 评测时间
2026-08-14 10:58:39 2026-08-14 10:58:45
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++) {
        for (i = 0; i < 100; i++) {
            int m = (lo[i] + hi[i]) >> 1;
            unsigned v = a[m];
            int less = (v < xs[i]);
            lo[i] = less ? (m + 1) : lo[i];
            hi[i] = less ? 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 #1295.55 us12 KBAcceptedScore: 100


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