提交记录 16049


用户 题目 状态 得分 用时 内存 语言 代码长度
ObsidianY 1003. 测测你的二分查找 Accepted 100 76.87 us 12 KB C++ 495 B
提交时间 评测时间
2021-03-19 21:56:34 2021-03-19 21:56:37
int binary_search(const unsigned *line, int ub, unsigned value){
    register int down = 0,up = ub - 1;
    register int estimate = 0;
    while( up - down > 255 ){
        estimate = down + 1ull * (up - down) * (value - line[down]) / (line[up] - line[down]);
        if( line[estimate] == value )return estimate;
        if( line[estimate] < value ) down = estimate + 1;
        else                           up = estimate - 1;
    }
    while( line[down] ^ value ) down ++;
    return down;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #176.87 us12 KBAcceptedScore: 100


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