My testcase is failing for testcase no 0. I download the test case and generate the output in my local workspace IDE. Afterwards, I download the expected testcase output from the Soultion tab and did diffCompare fine. The diff is identical. Why the codingblocks online compiler is detecting fail here?
Below is the code which I wrote.
#include
#include
#include
#include
#include
using namespace std;
int main() {
set st;
int n, k;
cin >> n >> k;
for(int i = 0; i < n; i++)
{
int queryType;
cin >> queryType;
if(queryType == 1)
{
int a, b;
cin >> a >> b;
long long int dist = pow(a,2) + pow(b,2);
st.insert(dist);
} else if(queryType == 2)
{
auto it = st.begin();
for (int j = 0; j < k-1 ; j++)
it++;
cout << *it << endl;
}
}
return 0;
}