Josif_tepe

Untitled

Sep 10th, 2025
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <queue>
  4. using namespace std;
  5.  
  6. int main() {
  7.     ios_base::sync_with_stdio(false);
  8.    
  9.     priority_queue<int, vector<int>, greater<int>> pq;
  10.     pq.push(1);
  11.     pq.push(5);
  12.     pq.push(3);
  13.     pq.push(2);
  14.     pq.push(8);
  15.    
  16.     while(!pq.empty()) {
  17.         cout << pq.top() << endl;
  18.         pq.pop();
  19.     }
  20.    
  21.  
  22.    
  23.    
  24.      return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment