-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1039.cpp
42 lines (42 loc) · 1.13 KB
/
1039.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Ivan Carvalho
// Solution to https://www.beecrowd.com.br/judge/problems/view/1039
#include <cstdio>
typedef long long ll;
int main() {
ll a, b, c, d, e, f, q, x, y;
while (scanf("%lld %lld %lld %lld %lld %lld", &a, &b, &c, &d, &e, &f) !=
EOF) {
x = e + d, y = f;
q = (x - b) * (x - b) + (c - y) * (c - y);
if (q > a * a) {
printf("MORTO\n");
continue;
}
x = e - d, y = f;
q = (x - b) * (x - b) + (c - y) * (c - y);
if (q > a * a) {
printf("MORTO\n");
continue;
}
x = e, y = f + d;
q = (x - b) * (x - b) + (c - y) * (c - y);
if (q > a * a) {
printf("MORTO\n");
continue;
}
x = e, y = f - d;
q = (x - b) * (x - b) + (c - y) * (c - y);
if (q > a * a) {
printf("MORTO\n");
continue;
}
q = (b - e) * (b - e) + (f - c) * (f - c);
ll compara = a - d;
if (q > compara * compara) {
printf("MORTO\n");
continue;
}
printf("RICO\n");
}
return 0;
}