irapilguy

Untitled

Jan 10th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <vector>
  4. using namespace std;
  5. #define N 202
  6. int mas[N][N];
  7. struct El {
  8.     int len;
  9.     El(int l) {
  10.         len = l;
  11.     }
  12. };
  13. struct compare
  14. {
  15.     bool operator()(const El& l, const El& r)
  16.     {
  17.         return l.len > r.len;
  18.     }
  19. };
  20. int main() {
  21.     int n, m;
  22.     std::priority_queue<El, vector<El> ,compare> heap;
  23.     cin >> n >> m;
  24.     for (int i = 1; i <= n; i++) {
  25.         int x;
  26.         cin >> x;
  27.         heap.push(El(x));
  28.     }
  29.     for (int i = 1; i <= n; i++) cout << heap.top().len << " ";
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment