Advertisement
Josif_tepe

Untitled

Apr 21st, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include<queue>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.     priority_queue<int> pq;
  11.     for(int i = 0; i < n; i++) {
  12.         int a;
  13.         cin >> a;
  14.         pq.push(a);
  15.     }
  16.     while(!pq.empty()) {
  17.         cout << pq.top() << " ";
  18.         pq.pop();
  19.     }
  20.     cout << endl;
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement