Playground
#include <iostream> #include <queue> using namespace std; int main() { priority_queue<int> pq; pq.push(3); pq.push(1); pq.push(5); cout << pq.top() << endl; //5 pq.pop(); cout << pq.top() << endl; //3 pq.pop(); cout << pq.top() << endl; //1 pq.pop(); pq.push(10); cout << pq.size() << endl; //1 return 0; }
Input data
Program output
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!