mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-01-11 21:51:59 +00:00
P3378 【模板】堆
R41079850
This commit is contained in:
parent
6069f24be1
commit
d2df3fd8d9
25
problem/P3378/P3378.cpp
Normal file
25
problem/P3378/P3378.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include<bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
priority_queue<int, vector<int>, greater<int> > q;
|
||||||
|
int n;
|
||||||
|
cin >> n;
|
||||||
|
while(n--) {
|
||||||
|
int op;
|
||||||
|
cin >> op;
|
||||||
|
if(op == 1) {
|
||||||
|
int x;
|
||||||
|
cin >> x;
|
||||||
|
q.push(x);
|
||||||
|
}
|
||||||
|
else if(op == 2) {
|
||||||
|
cout << q.top() << endl;
|
||||||
|
}
|
||||||
|
else if(op == 3) {
|
||||||
|
q.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user