#include <bits/stdc++.h>
#define int long long
using namespace std;
// code here.
int n, m, rt[N];
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> m;
for (int i = 1, a; i <= n; ++i) cin >> a, rt[i] = newnode(a, i);
for (int op, x, y, z; m; --m) {
if (cin >> op >> x, op == 1)
cout << top(rt[x]) << '\n';
else if (cin >> y, op == 2)
join(rt[x], rt[y]);
else if (op == 3)
cin >> z, decrease_key(rt[x], y, z);
else
erase(rt[x], y);
}
return cout << flush, 0;
}剪贴板
剪贴板 xmyqmbqu
剪贴板信息
剪贴板信息
- 收录
- 更新