Bad Test Case of sgu-151?

Revision en2, by Georeth, 2020-04-08 15:29:22

SGU-151

Exactly the same code, GNU C++11 got WA on test #19 75830647, GNU C++14 got AC 75830595. I submitted 30 times to find the problem.

#include <cstdio>
#include <cmath>
static const double EPS = 1e-13;
int main() {
    double c, b, m; scanf("%lf%lf%lf", &c, &b, &m);
    double c2 = c * c, b2 = b * b, m2 = m * m;
    double a2 = 2 * (b2 + c2) - 4 * m2;
    if (a2 < 0) {
        printf("Mission impossible");
        return 0;
    }
    double a = sqrt(a2);
    if ((a + b < c) || (a + c < b) || (b + c < a)) {
        printf("Mission impossible");
        return 0;
    }
    double x = (c2 - b2) / (2 * a);
    if (fabs(a) < EPS) x = 0;
    double y = sqrt(m2 - x * x);
    printf("%.5lf %.5lf\n",x,y);
    printf("%.5lf %.5lf\n",-(a)/(double)2.0,(double)0);
    printf("%.5lf %.5lf",(a)/(double)2.0,(double)0);
    return 0;
}

I hope the Codeforces maintainers verify the test data and my report of SGU-124

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Georeth 2020-04-08 15:29:22 75
en1 English Georeth 2020-04-08 15:11:27 1044 Initial revision (published)