Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
353 B
6
Indexable
Never
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int size;
    std::cin >> size;

    std::vector<int> arr(size);
    for (int i = 0; i < size; ++i) {
        std::cin >> arr[i];
    }

    std::sort(arr.begin(), arr.end());

    for (int i = 0; i < size; i += 2) {
        std::cout << arr[i] << " ";
    }

    return 0;
}