如果你使用pbds但是76分
查看原帖
如果你使用pbds但是76分
580608
lupengheyyds楼主2024/6/3 09:54

那么请注意询问排名时是否是用的

la=bst.order_of_key(*bst.lower_bound({x,0}))+1,xa^=la;

应该改为

la=bst.order_of_key({x,0})+1,xa^=la;

这是因为如果此时平衡树中所有数都比 x 小,那么bst.lower_bound({x,0})==bst.end()而*bst.end()=={0,0}所以就变成了bst.order_of_key({0,0})==0

2024/6/3 09:54
加载中...