Why This problem is giving wrong ans on submission if I’m doing it with help of Priority_queue.
My Code IS Here:
/************************/
void solve()
{
priority_queue maxPriceCandy;
int n,k,m;
cin>>n>>k>>m;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
maxPriceCandy.push(x);
}
int ans;
while(!maxPriceCandy.empty())
{
if(maxPriceCandy.top()*k <= m)
{
ans=maxPriceCandy.top();
break;
}else
{
maxPriceCandy.pop();
}
}
cout<<ans<<endl;
}