提交记录 13837


用户 题目 状态 得分 用时 内存 语言 代码长度
CraZYali 1003. 测测你的二分查找 Accepted 100 325.75 us 12 KB C++ 326 B
提交时间 评测时间
2020-08-12 18:27:18 2020-08-12 18:27:21
int lst = -1;
unsigned lstx;

int binary_search(const unsigned *a, int n, unsigned x)
{
	int l, r;
	l = 0;r = n - 1;
	if (lst > 0)
		if (x > lstx) l = lst + 1;
		else r = lst - 1;
	lstx = x;
	while (l <= r)
	{
		int mid = l + r >> 1;
		if (a[mid] == x) return mid;
		else if (a[mid] < x) l = mid + 1;
		else r = mid - 1;
	}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1325.75 us12 KBAcceptedScore: 100


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