I have been attempting the Hostel problem in the Challenges-STL section. I’ve made multiple attempts to solve it using different approaches but each time I’ve not passed a single TC. I downloaded the TC’s to check where I am going wrong but I think the expected output and my output are identical. I’m not sure if there is a printing issue or something but I’m unable to pass any test cases, please do guide.
int32_t main()
{
c_p_c();
int q, k;
cin>>q>>k;
pqb pq1;
rep(i,q){
int a;
cin>>a;
if(a==1){
int x,y;
cin>>x>>y;
int distance = xx + yy;
if(pq1.size()<k)pq1.push(distance);
else{
if(pq1.top()>distance){
pq1.pop();
pq1.push(distance);
}
}
}
else{
cout<<pq1.top()<<’\n’;
}
}
return 0;
}
