I was solving the Right Triangle problem (https://www.codechef.com/problems/RIGHTTRI)

and I coded the following solution using a bit of trigonometry:-

```
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long t;
cin >> t;
while(t--)
{
long double h, s;
cin >> h >> s;
long double val = 4*s/pow(h,2);
if(!(val > 0 && val < 1))
{
cout << -1;
}
else
{
long double a,b,c;
long double theta = (asin(val)/2);
a = h*cos(theta);
b = h*sin(theta);
c = h;
cout << fixed << setprecision(6) << min(a,b) << " " << max(a,b) << " " << c;
}
cout << "\n";
}
return 0;
}
```

I am getting exactly the same output as given in the problem:-

```
3.000000 4.000000 5.000000
-1
-1
285168.817674 546189.769984 616153.000000
```

But on submitting the solution I am getting WA. What is wrong? Please help.