STL函数

lower_bound(a.begin(),a.end(),x)返回第一个大于等于 x 的数的地址
upper_bound(a.begin(),a.end(),x)返回第一个小于等于 x 的数的地址

而由于是地址,在最后要 −a(也就是减去地址)