forked from Mugdha-Hazra/codechef
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contest: COOK128C2.cpp
39 lines (37 loc) · 1.3 KB
/
Contest: COOK128C2.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
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
set<int> s;
int n,x,c=0,p=0,z=0,q=0,a[1000000000];
cin>>n>>x;
for(int i=0;i<n;i++)
{ cin>>a[i];
}
for(auto i=0;i<n;i++)
{
s.insert(a[i]);
}
for(auto it=s.begin();it!=s.end();it++)
{
p++;
//cout<<*it<<" $ ";
}
//cout<<p<<"*";
if(n-p>=x)
cout<<p<<"\n";
else
{
z=n-p;
q=x-z;
p=p-q;
cout<<p<<"\n";
}
}
return 0;
}