Skip to content

Commit 52da037

Browse files
committed
Added 1692B - All Distinct.cpp
1 parent 662a36b commit 52da037

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

1692B - All Distinct.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int t;
12+
cin>>t;
13+
while(t--)
14+
{
15+
int n;
16+
cin>>n;
17+
int a[n];
18+
set<int> st;
19+
for(int i=0; i<n; i++)
20+
{
21+
cin>>a[i];
22+
st.insert(a[i]);
23+
}
24+
int l = st.size();
25+
cout<<((n-l)%2==0?l:l-1)<<endl;
26+
}
27+
return 0;
28+
}

0 commit comments

Comments
 (0)