提交记录 32443


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1003. 测测你的二分查找 Accepted 100 295 us 12 KB C 1.50 KB
提交时间 评测时间
2026-08-14 11:02:05 2026-08-14 11:02:26
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], m[100]; unsigned v[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++) m[i] = (lo[i] + hi[i]) >> 1;
        #define LD(k) v[k] = a[m[k]]
        LD(0);LD(1);LD(2);LD(3);LD(4);LD(5);LD(6);LD(7);LD(8);LD(9);
        LD(10);LD(11);LD(12);LD(13);LD(14);LD(15);LD(16);LD(17);LD(18);LD(19);
        LD(20);LD(21);LD(22);LD(23);LD(24);LD(25);LD(26);LD(27);LD(28);LD(29);
        LD(30);LD(31);LD(32);LD(33);LD(34);LD(35);LD(36);LD(37);LD(38);LD(39);
        LD(40);LD(41);LD(42);LD(43);LD(44);LD(45);LD(46);LD(47);LD(48);LD(49);
        LD(50);LD(51);LD(52);LD(53);LD(54);LD(55);LD(56);LD(57);LD(58);LD(59);
        LD(60);LD(61);LD(62);LD(63);LD(64);LD(65);LD(66);LD(67);LD(68);LD(69);
        LD(70);LD(71);LD(72);LD(73);LD(74);LD(75);LD(76);LD(77);LD(78);LD(79);
        LD(80);LD(81);LD(82);LD(83);LD(84);LD(85);LD(86);LD(87);LD(88);LD(89);
        LD(90);LD(91);LD(92);LD(93);LD(94);LD(95);LD(96);LD(97);LD(98);LD(99);
        #undef LD
        for (i = 0; i < 100; i++) { if (v[i] < xs[i]) lo[i] = m[i] + 1; else hi[i] = m[i]; }
    }
    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 us12 KBAcceptedScore: 100


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