fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // priority_queue
  6. // push
  7. // size
  8. // top pop empty
  9. priority_queue<int> pq;
  10. pq.push(1);
  11. pq.push(5);
  12. pq.push(2);
  13. pq.push(6);
  14.  
  15. cout << pq.top(); // print 6
  16. pq.pop();
  17. cout << pq.top(); // print 5
  18. cout << endl;
  19.  
  20. priority_queue<pair<int,int>> pq2;
  21. pq2.push({1, 5});
  22. pq2.push({1, 6});
  23. pq2.push({1, 7});
  24. cout << pq2.top().first;
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
65
1