-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path303.cpp
59 lines (48 loc) · 1.2 KB
/
303.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
#include <bits/stdc++.h>
using namespace std;
void solve()
{
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
//int _t;cin>>_t;while(_t--)
int T,i;
cin>>T;
int** box = new int*[T];
int *subbox = new int[T];
for(int i=0;i<T;i++)
{
cin>>subbox[i];
box[i] = new int[subbox[i]];
for(int j=0;j<subbox[i];j++)
cin>>box[i][j];
}
int visited = -1;
for(int i=0;i<T;i++)
{
//Array fr will store frequencies of element
int* fr= new int[subbox[i]];
for(int j = 0; j < subbox[i]; j++){
int count = 1;
for(int k = j+1; k < subbox[i]; k++){
if(box[i][j] == box[i][k]){
count++;
//To avoid counting same element again
fr[k] = visited;
}
}
if(fr[j] != visited)
fr[j] = count;
}
for(int j = 0; j < subbox[i]; j++){
if(fr[j] != visited){
if(fr[j]%2!=0)
{
cout<<box[i][j]<< endl;
}
}
}
}
return 0;
}