求助(S组初赛模拟的一道题)
查看原帖
求助(S组初赛模拟的一道题)
1051647
fight_for_humanity楼主2024/8/18 18:55

这是今天S组初赛模拟的一道题。

set <int> intersection(set <int> a, set <int> b) {
	if (a.size() > b.size()) swap(a, b);
	set <int> res = a;
	for (int i : a)
		if (b.count(i) == 0)
	res.erase(i);
	return res;
}

"设集合 a,ba,b 的元素个数分别为 p,qp,q,则执行函数 intersection(a,b)intersection(a,b) 的时间复杂度为 Θ(min(?,?)⋅log⁡max(?,?))Θ(min(?, ?) \cdot \log{max(?, ?)})"这句话为什么是错的?

2024/8/18 18:55
加载中...