Codeforces
CF Step
Youtube Linkedin Discord Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Code : Farmer John's Challenge

#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

void solve() {
    int n, k;
    cin >> n >> k;

    if (k == n) {
        for (int i = 0; i < n; i++) {
            cout << 1 << " ";
        }
        cout << endl;
        return;
    }

    if (k == 1) {
        for (int i = 0; i < n; i++) {
            cout << i + 1 << " ";
        }
        cout << endl;
        return;
    }

    cout << -1 << endl;
    return;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    for (int zz = 0; zz < t; zz++) {
        solve();
    }
    return 0;
}