# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
949762 | rainboy | 직사각형 게임 (KPI13_game) | C++17 | 1 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <math.h>
#include <stdio.h>
#define eps 1e-9
double abs_(double a) { return a > 0 ? a : -a; }
int main() {
double alpha, beta, z;
int a, b, c, d, tmp, first;
scanf("%d%d%d%d", &a, &b, &c, &d), z = hypot(c, d);
if (a < b)
tmp = a, a = b, b = tmp;
if (c < d)
tmp = c, c = d, d = tmp;
alpha = atan2(d, c) * 2;
first = 0;
if (b >= z)
first = 1;
else if (a * a + b * b < c * c + d * d)
first = 0;
else {
if (b * b <= c * c + d * d) {
beta = asin((double) b / z);
if (abs_(z * cos(beta + alpha)) <= a + eps && abs_(z * sin(beta + alpha)) <= b + eps)
first = 1;
if (abs_(z * cos(beta - alpha)) <= a + eps && abs_(z * sin(beta - alpha)) <= b + eps)
first = 1;
}
if (a * a <= c * c + d * d) {
beta = acos((double) a / z);
if (abs_(z * cos(beta + alpha)) <= a + eps && abs_(z * sin(beta + alpha)) <= b + eps)
first = 1;
if (abs_(z * cos(beta - alpha)) <= a + eps && abs_(z * sin(beta - alpha)) <= b + eps)
first = 1;
}
}
printf(first ? "First\n" : "Second\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |