Natus ad codicem#12197

Natus ad codicem (Розбір)

Solution is array [1 , 2 , 1 , 2 , 1 , 2 ...]

Number of subsegments that are permutations is number of 1 plus all subsegments length 2 it is \lfloor (n+1) / 2\rfloor + n - 1 \geqslant \lfloor3n/2\rfloor - 1

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cout << (i % 2) + 1 << " ";
    }
    cout << endl;
}