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