-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrr-Brrr-Patapim.cpp
More file actions
74 lines (68 loc) · 1.16 KB
/
Brr-Brrr-Patapim.cpp
File metadata and controls
74 lines (68 loc) · 1.16 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
template<typename T>
T max(T x,T y)
{
return x>y?x:y;
}
template<typename T>
T min(T x,T y)
{
return x<y?x:y;
}
void solve() {
ll n;
cin>>n;
vector<vector<ll>> g(n,vector<ll> (n));
for(ll i=0;i<n;i++)
{
for(ll j=0;j<n;j++)
{
cin>>g[i][j];
}
}
vector<ll> ans(2*n+1,0);
vector<ll> mp(2*n+1,0);
for(ll i=0;i<n;i++)
{
for(ll j=0;j<n;j++)
{
if(ans[i+j+1+1]==0)
{
ans[i+j+1+1]=g[i][j];
mp[ans[i+j+1+1]]=1;
}
}
}
for(int i=1;i<=2*n;i++)
{
if(ans[i]==0)
{
for(int j=1;j<=2*n;j++)
{
if(mp[j]==0)
{
ans[i]=j;
break;
}
}
break;
}
}
for(int i=1;i<=2*n;i++)
{
cout<<ans[i]<<" ";
}
cout<<endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
solve();
}
return 0;
}