-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGCJ_R1_P2.cpp
More file actions
executable file
·64 lines (60 loc) · 1022 Bytes
/
Copy pathGCJ_R1_P2.cpp
File metadata and controls
executable file
·64 lines (60 loc) · 1022 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include<bits/stdc++.h>
using namespace std;
void add(int test[11],int tab[11][11],int n){
cout<<test[0]<<" "<<test[1]<<" "<<test[2]<<endl;
bool b=false;
for(int i=0;i<n;i++){
if(tab[i][0]!=-1){
if(tab[i][0]>=test[0])
{
cout<<"here"<<endl;
b=true;}
}
if((b==false)&&((tab[i][0])>0)){
for(int j=0;j<n;j++){
tab[i][j]=test[j];}
}
}
}
int main()
{
//freopen("A-large.in","r",stdin);
//freopen("A-large.out","w",stdout);
int T;
cin>>T;
for(int i=0;i<T;i++){
int n;
cin>>n;
int res[n];
int tab[11][11];
//int vis[n]={0};
vector<vector<int> > mat;
mat.resize((2*n)-1);
cout<<(2*n)-1<<endl;
for(int j=0;j<(2*n)-1;j++){
for(int k=0;k<n;k++){
int x;
cin>>x;
mat[j].push_back(x);
}
}
sort(mat.begin(),mat.end());
for(int j=0;j<(2*n-1);j++){
int test[11];
for(int k=0;k<n;k++){
test[k]=mat[j][k];
//cout<<mat[j][k]<<" ";
}
//cout<<endl;
add(test,tab,n);
}
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
cout<<tab[j][k]<<" ";
}
cout<<endl;
}
cout<<"Case #"<<i+1<<": "<<endl;
}
return 0;
}