STL 库是 C++ 语言的标准库,我们在比赛中主要用到的有如下内容。string 类substrfindreplaceinserterasec_str容器pairvectordequeliststackqueuepriority_queuemapunordered_mapsetunordered_set算法库函数调用示意说明sortsort(v.begin(), v.end())快速排序stable_sortstable_sort(v.begin(), v.end())稳定排序uniqueunique(v.begin(), v.end())去重,返回的是去重后的元素末地址。可以结合 erase 函数来把多余数据删除next_permutationnext_permutation(v, v+n)返回全排列的下一个值,当没有下一个排列时,函数返回 falseprev_permutationprev_permutation(v, v+n)返回全排列的上一个值,当没有上一个排列时,函数返回 falsenth_elementnth_element(v.begin(), v.begin() + k, v.end()),函数执行后,v.begin()+k 位置的数为排序后的最终位置,即左边的数都小于它,后面的数都大于它lower_boundslower_bounds(v, v+n, a)查找大
...
继续阅读
(1)