is the given reason correct int the code which is wriitten in a comment beside the variable “distinct” for i did not understood the reason behind it although the code gives a correct answer.
Please help me out.
problem link NOBEL Problem - CodeChef
/*freopen("ride.in","r",stdin);
freopen("ride.out","w",stdout);*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n,m;
cin>>n>>m;
ll distinct=1; //we should initialise it with 0 since there would always be one distinct topic available and therefore if the initial count is zero it would give us the WRONG ANSWER.
ll a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
for(int j=0;j<n-1;j++)
{
if(a[j+1]!=a[j])
{
distinct++;
}
}
if(m-distinct>0)
{
cout<<"yes"<<endl;
}
else
{
cout<<"no"<<endl;
}
}
return 0;
}