-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP173PROC.cpp
More file actions
45 lines (41 loc) · 888 Bytes
/
P173PROC.cpp
File metadata and controls
45 lines (41 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<bits/stdc++.h>
using namespace std;
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Ford(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define here cout<<"I am Here"<<endl;
int const maxn = 1000000;
int const base = 1e9 + 7;
int a[maxn];
int main(void){
int T;
cin>>T;
while(T--){
memset(a, 0, sizeof a);
int N, k;
cin>>N>>k;
For(i, 1, N) a[i] = i;
if(k == 0){
For(i, 1, N) cout<<i<<" ";
cout<<endl;
}
else{
if(N % 2 != 0 || N % (2 * k) != 0){
cout<<"-1"<<endl;
}
else{
int x = 1, y = k + 1;
while(y <= N){
For(i, y, y + 2 * k - k - 1){
cout<<a[i]<<" ";
}
For(i, x, x + k - 1) cout<<a[i]<<" ";
x += 2 * k;
y += 2 * k;
}
cout<<endl;
}
}
}
return 0;
}