Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int n;
- cin >> n;
- vector<int> A(n);
- Heap H;
- for(int i = 0; i < n; i++)
- {
- cin >> A[i];
- H.Add(A[i]);
- }
- for(int i = n - 1; i >= 0; i--)
- {
- A[i] = H.top();
- H.pop();
- }
- for(int i = 0; i < n; i++)
- cout << A[i] << ' ';
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement