1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| list<int> l; l.push_back(), l.push_front(); l.pop_back(), l.pop_front(); l.back(), l.front();
priority_queue<int> heap;
priority_queue<int, vector<int>, greater<int>> heap;
struct Node { int x, y; bool operator< (const Node &t) const { return x > t.x; } }; priority_queue<Node> heap;
map<int, int> mp; set<int> S; mp.size(); mp.empty(); mp.insert({key, value}); mp.erase(key); mp.find(key) != mp.end(); mp.count(key); s.size() / s,empty() / s.clear() s.begin() / s.end() set <int> :: iterator it s.insert(x):插入x s.find(x): 寻找元素x,并返回指向该元素迭代器 s.lower_bound(x) , s.upper_bound(x) s.erase(it) : 删除迭代器it指向的元素 / s.erase(x) : 删除集合中所有大小为x的元素 s.count(x) : 返回集合中x元素的个数
sort(q, q + n); sort(q, q + n, greater<int>()); sort(q, q + n, cmp); reverse(q, q + n); int pos = lower_bound(q, q + n, x) - q; int pos = upper_bound(q, q + n, x) - q; int n = unique(q, q + n) - q;
strstr(s1, s2): 判断字符串s2是否是s1的子串 O(n) strchr(s, c): 在字符串s中查找字符c第一次出现的位置 O(n) strcmp(s1, s2): 比较两个字符串是否相等 O(n) s.substr(l, len): 返回s中从下标l开始长度为len的子串
|