RT只需帮我修证暴力排序的错误,不必告诉正解,谢谢!
#include <bits/stdc++.h>
using namespace std;
int n, m;
priority_queue<int, vector<int>, greater<int>> q;
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i ++)
{
int x;
cin >> x;
q.push(x);
}
for(int i = 1; i <= m; i ++)
{
int x;
cin >> x;
q.push(x);
cout << q.top() << "\n";
q.pop();
}
return 0;
}