Submission #77151859
Source Code Expand
Copy
#include <stdio.h>int main(void) {int T, tc;if (scanf("%d", &T) != 1) return 1;for (tc = 0; tc < T; tc++) {int X1, Y1, R1, X2, Y2, R2;long long a, b, c;if (scanf("%d%d%d%d%d%d", &X1, &Y1, &R1, &X2, &Y2, &R2) != 6) return 1;a = (long long)(R1 - R2) * (R1 - R2);b = (long long)(X1 - X2) * (X1 - X2) + (long long)(Y1 - Y2) * (Y1 - Y2);c = (long long)(R1 + R2) * (R1 + R2);puts(a <= b && b <= c ? "Yes" : "No");}return 0;}/*Yes iff |R1 - R2| <= 中心の距離 <= R1 + R2*/
#include <stdio.h>
int main(void) {
int T, tc;
if (scanf("%d", &T) != 1) return 1;
for (tc = 0; tc < T; tc++) {
int X1, Y1, R1, X2, Y2, R2;
long long a, b, c;
if (scanf("%d%d%d%d%d%d", &X1, &Y1, &R1, &X2, &Y2, &R2) != 6) return 1;
a = (long long)(R1 - R2) * (R1 - R2);
b = (long long)(X1 - X2) * (X1 - X2) + (long long)(Y1 - Y2) * (Y1 - Y2);
c = (long long)(R1 + R2) * (R1 + R2);
puts(a <= b && b <= c ? "Yes" : "No");
}
return 0;
}
/*
Yes iff |R1 - R2| <= 中心の距離 <= R1 + R2
*/
Submission Info
| Submission Time | |
|---|---|
| Task | B - Two Rings |
| User | mikecat |
| Language | C23 (GCC 14.2.0) |
| Score | 250 |
| Code Size | 532 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 1704 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 250 / 250 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 1636 KiB |
| 01_random_00.txt | AC | 1 ms | 1564 KiB |
| 01_random_01.txt | AC | 1 ms | 1640 KiB |
| 01_random_02.txt | AC | 1 ms | 1704 KiB |
| 01_random_03.txt | AC | 1 ms | 1616 KiB |
| 01_random_04.txt | AC | 1 ms | 1600 KiB |
| 01_random_05.txt | AC | 1 ms | 1640 KiB |
| 01_random_06.txt | AC | 1 ms | 1644 KiB |
| 01_random_07.txt | AC | 1 ms | 1704 KiB |
| 01_random_08.txt | AC | 1 ms | 1640 KiB |
| 01_random_09.txt | AC | 1 ms | 1636 KiB |
| 01_random_10.txt | AC | 1 ms | 1564 KiB |
| 01_random_11.txt | AC | 1 ms | 1608 KiB |