-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Diverse_Game.cpp
56 lines (49 loc) · 1.06 KB
/
A_Diverse_Game.cpp
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
46
47
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h>
using namespace std;
#define fr(i, n) for (lli i = 0; i < n; i++)
#define fr1(i, n) for (lli i = 1; i <= n; i++)
#define pb push_back
#define sz(x) (lli) x.size()
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define debug(x) cout << '>' << #x << ':' << x << endl;
using lli = long long int;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
lli t;
cin >> t;
while (t--)
{
lli n, m;
cin >> n >> m;
lli arr[n][m];
fr(i, n) fr(j, m) cin >> arr[i][j]; // Input for the 2D array
if (n == 1 && m == 1)
{
cout << -1 << endl;
}
else if (n == 1)
{
fr1(i, m)
{
cout << arr[0][i%m] << " ";
}
cout << endl;
}
else
{
fr1(i, n)
{
fr(j, m)
{
cout << arr[i%n][j] << " ";
}
cout << endl;
}
}
}
return 0;
}