Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
460 B
7
Indexable
Never
#include <iostream>
#include <vector>

int main(){
    int n;
    std::cin >> n;
    std::vector<int> vec(n);
    for (int i = 0; i < n; ++i){
        std::cin >> vec[i];
    }
    int ans = n / 2;
    int mid = (n + 1) / 2;
    int left = 1 + ans;
    int right = 1;
    std::cout << ans << '\n';
    for (auto val: vec){
        std::cout << ((val <= mid) ? left + val - 1 : right + val - mid - 1) << ' ';
    }
    std::cout << '\n';   
}