-
Notifications
You must be signed in to change notification settings - Fork 0
/
homometric.cpp
125 lines (105 loc) · 2.47 KB
/
homometric.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// “Ayo, these ain’t lookin like shooting stars”
//
// -Dinosaurs
#include <bits/stdc++.h>
using namespace std;
typedef long long lg;
const lg N = 9; // BIG LOOOOOOOOOL 7
//lg ar[N][N];
int main()
{
bool flag=true;
lg brk, n,j, t, k,h,i,m,ah,am,a,b,c,x,count;
cin>>count;
lg indata[count],indata2[count];
lg ar[count][count];
vector<lg>v,v2;
for (i = 0; i < count; i++)
{
cin>>indata[i];
}
for (i = 0; i < count; i++)
{
cin>>indata2[i];
}
for ( i = 0; i < count; i++)
{
for ( j = 0; j < count; j++)
{
if(j>i)
{
ar[i][j]=indata[j]-indata[i];
v.push_back(indata[j]-indata[i]);
}
else
ar[i][j]=-1;
}
}
//for output full matrix
cout<<"1st matrix :"<<endl;
for ( i = 0; i < count; i++)
{
for ( j = 0; j < count; j++)
{
cout<<ar[i][j]<<" ";
}
cout<<endl;
}
lg sz=v.size();
sort(v.begin(),v.end());
cout<<endl;
//for x2
cout<<"2nd x2"<<endl;
for ( i = 0; i < count; i++)
{
for ( j = 0; j < count; j++)
{
if(j>i)
{
ar[i][j]=indata2[j]-indata2[i];
v2.push_back(indata2[j]-indata2[i]);
}
else
ar[i][j]=-1;
}
}
cout<<"2nd matrix :"<<endl;
for ( i = 0; i < count; i++)
{
for ( j = 0; j < count; j++)
{
cout<<ar[i][j]<<" ";
}
cout<<endl;
}
sz=v2.size();
sort(v2.begin(),v2.end());
cout<<endl;
cout<<"X1: ";
for ( i = 0; i < sz; i++)
{
cout<<v[i]<<" ";
}
cout<<endl;
cout<<endl;
cout<<"X2: ";
for ( i = 0; i < sz; i++)
{
cout<<v2[i]<<" ";
}
cout<<endl;
cout<<endl;
flag=true;
for ( i = 0; i < sz; i++)
{
if(v[i]!=v2[i])
{
cout<<"Its not homomatric!"<<endl;
flag =false;
break;
}
}
if(flag)
cout<<"Its homomatric!"<<endl;
return 0;
}