关于使用map套set所导致的超时问题
查看原帖
关于使用map套set所导致的超时问题
1169915
miku010123楼主2025/1/23 02:14

本蒟蒻发现自己写的代码和别人近乎一致, 但是耗时却很大,经过水群(bushi),

发现了一个问题:

std::lower_bound(set.begin,set.end,num)

set.lower_bound(num)

差别很大。

大到什么地步呢?

使用set.lower_bound(num)跑了400ms

使用std::lower_bound(set.begin,set.end,num)跑了2208ms.

应该是底层实现的不同,导致差异这么大.

特发此贴,希望大家不要犯和我同样的错误喵QAQ

2025/1/23 02:14
加载中...