priority_queue<>
bool operator<(Node a, Node b){
if( a.x== b.x ) return a.y> b.y;
return a.x> b.x;
}
priority_queue<int, vector<int>, greater<int> > q;
迭代器
vector<int>::iterator iter;
for(iter = v.begin();iter!=v.end();iter++){}
离散
vector<int> ve;
int fid(int x){
return lower_bound(ve.begin(),ve.end(),x)-ve.begin();
}
sort(ve.begin(),ve.end());
ve.erase(unique(ve.begin(),ve.end(),ve.end());
mp[fid(x)];
const int SIZE = 1000000;
const int M = 999997;
struct HashTable {
struct Node {
int next, value, key;
} data[SIZE];
int head[M], size;
int f(int key) { return key % M; }
int get(int key) {
for (int p = head[f(key)]; p; p = data[p].next)
if (data[p].key == key) return data[p].value;
return -1;
}
int modify(int key, int value) {
for (int p = head[f(key)]; p; p = data[p].next)
if (data[p].key == key) return data[p].value = value;
}
int add(int key, int value) {
if (get(key) != -1) return -1;
data[++size] = (Node){head[f(key)], value, key};
head[f(key)] = size;
return value;
}
};
bitset
#include <bitset>
bitset<(size)> bt;
bitset<(size)> bt(int/long/chars);
cout << bt << endl;
.count()
.any()
.none()
.set(pos, val = true/false)
.to_string()