#include
#include
using namespace std;
int main() {
int q,k;
cin>>q>>k;
priority_queue<int> pq;
for (int i = 0; i < q; i++)
{
int d;
cin>>d;
if (d==1)
{
int x,y;
cin>>x>>y;
int dist = x*x + y*y;
pq.push(dist);
if (pq.size()>k)
{
pq.pop();
}
}
else if (d==2)
{
cout<<pq.top()<<endl;
}
}
return 0;
}
This is my code for this question. I have dry ran this code with different test cases and its working fine. But it is only passing test case 4 here. Is there a problem with my code or are the test cases incorrect?