版本比较
题解:P11266 【模板】可并堆 2
正文
增加 5 行删除 5 行
63 行未改动6465666768686970717214 行未改动878889909191929394959495969798991001001011021031049 行未改动63 行未改动#define endl "\n"
const int N = 1e6 + 10;
int n, m; int n, m;
__gnu_pbds::priority_queue<int, greater<int> > q[N];// 第一个参数 int:队列中存储的数据类型// 第二个参数 greater<int>:优先级14 行未改动 t[i] = q[i].push(x); // 向 q[i] 队列中插入元素 x,并将返回的迭代器存入 t[i] }
while (m--) { int opt, x, y, z; int opt, x, y, z; cin >> opt;
if (opt == 0) { cin >> x >> y; if (opt == 0) { cin >> x >> y; q[x].erase(t[y]); // 将迭代器为 t[y] 的值删除 } else if (opt == 1) { cin >> x; cout << q[x].top() << endl; } else if (opt == 2) { } else if (opt == 2) { cin >> x >> y; q[x].join(q[y]); // 将 q[y] 合并进 q[x] } else { cin >> x >> y >> z;9 行未改动