编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5868 #1059. 牛车采矿 Wrong Answer 0 565 ms 1476 K C / 1.5 K u430034042 2024-08-17 16:42:04
显示原始代码
#include <stdio.h>
#include <math.h>

double calculate_distance(double x, double y, double x1, double y1, double x2, double y2) {
    if (x1 <= x && x <= x2 && y1 <= y && y <= y2) {
        return 0.0;
    } else if (x1 <= x && x <= x2) {
        return (y - y1 < y2 - y) ? y - y1 : y2 - y;
    } else if (y1 <= y && y <= y2) {
        return (x - x1 < x2 - x) ? x - x1 : x2 - x;
    } else {
        double d1 = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
        double d2 = sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));
        double d3 = sqrt((x - x1) * (x - x1) + (y - y2) * (y - y2));
        double d4 = sqrt((x - x2) * (x - x2) + (y - y1) * (y - y1));
        double min = d1;
        if (d2 < min)
            min = d2;
        if (d3 < min)
            min = d3;
        if (d4 < min)
            min = d4;
        return min;
    }
}

int main() {
    int n;
    scanf("%d", &n);
    double x1, y1, x2, y2;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    double distances[n];
    double min_distance = 1e9;
    int min_index = -1;

    for (int i = 0; i < n; i++) {
        double x, y;
        scanf("%lf %lf", &x, &y);
        double distance = calculate_distance(x, y, x1, y1, x2, y2);
        distances[i] = distance;
        if (distance < min_distance) {
            min_distance = distance;
            min_index = i + 1;
        }
    }

    for (int i = 0; i < n; i++) {
        printf("%.9lf ", distances[i]);
    }
    printf("\n");
    printf("%d\n", min_index);

    return 0;
}
子任务 #1
Wrong Answer
得分:0
测试点 #1
Wrong Answer
得分:0
用时:2 ms
内存:244 KiB

输入文件(cow1.in

100
-33 3 -33 3
-15 -62
76 20
-43 73
-77 77
40 -54
-13 -12
-52 -25
-25 60
-50 -97
-81 -64
46 55
42 8
<606 bytes omitted>

答案文件(cow1.out

67.446274916 110.317722964 70.710678119 86.092973000 92.617492948 25.000000000 33.837848631 57.55866
<1233 bytes omitted>

用户输出

67.446274916 110.317722964 70.710678119 86.092973000 92.617492948 25.000000000 33.837848631 57.558665725 101.434708064 82.419657
<1206 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:3 ms
内存:380 KiB

输入文件(cow2.in

100
83 -62 83 -62
-100 -39
-85 39
38 -26
84 29
-53 66
91 100
83 77
62 84
-73 65
-6 88
-81 -67
-1 -4

<593 bytes omitted>

答案文件(cow2.out

184.439692041 196.022957839 57.628118137 91.005494340 186.761880479 162.197410584 139.000000000 147.
<1274 bytes omitted>

用户输出

184.439692041 196.022957839 57.628118137 91.005494340 186.761880479 162.197410584 -139.000000000 147.502542351 201.159140980 174
<1248 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #3
Wrong Answer
得分:0
用时:114 ms
内存:976 KiB

输入文件(cow3.in

100000
17 75 17 75
5 -5
-61 70
88 16
-25 -78
-72 -58
35 0
-40 66
36 26
-42 -86
21 17
44 93
-27 -58
6
<682143 bytes omitted>

答案文件(cow3.out

80.894993665 78.160092119 92.314679223 158.660013866 160.031246949 77.129760793 57.706152185 52.5547
<1350287 bytes omitted>

用户输出

80.894993665 78.160092119 92.314679223 158.660013866 160.031246949 77.129760793 57.706152185 52.554733374 171.470114014 58.13776
<1351229 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #4
Wrong Answer
得分:0
用时:115 ms
内存:1208 KiB

输入文件(cow4.in

100000
43 -5 43 -5
-16 -70
56 67
26 21
22 58
-28 -51
-58 -92
-22 100
39 -13
82 -82
96 -20
-54 -23
-5
<683015 bytes omitted>

答案文件(cow4.out

87.783825389 73.164198895 31.064449134 66.407830864 84.599054368 133.304163476 123.490890352 8.94427
<1333958 bytes omitted>

用户输出

87.783825389 73.164198895 31.064449134 66.407830864 84.599054368 133.304163476 123.490890352 8.944271910 86.313382508 55.0817574
<1334899 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #5
Wrong Answer
得分:0
用时:3 ms
内存:308 KiB

输入文件(cow5.in

100
84 49 85 50
24 -6
33 39
50 97
0 -19
41 -21
10 5
21 -69
-72 95
-76 -12
90 34
-11 60
68 34
-73 88

<601 bytes omitted>

答案文件(cow5.out

81.394102980 51.971145841 58.008620049 108.074048689 82.152297594 86.092973000 133.764718816 162.360
<1261 bytes omitted>

用户输出

81.394102980 51.971145841 58.008620049 108.074048689 82.152297594 86.092973000 133.764718816 162.360709533 171.233758354 15.8113
<1236 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #6
Wrong Answer
得分:0
用时:2 ms
内存:244 KiB

输入文件(cow6.in

100
-15 -83 -14 -82
75 -99
-52 53
-10 2
49 34
6 67
37 -62
-74 -77
-41 -82
-74 0
-32 -5
-74 -52
59 -9
<599 bytes omitted>

答案文件(cow6.out

90.426765949 139.978569788 84.095184167 132.003787824 150.336289697 54.781383699 59.211485372 26.000
<1250 bytes omitted>

用户输出

90.426765949 139.978569788 84.095184167 132.003787824 150.336289697 54.781383699 59.211485372 -26.000000000 101.019800039 78.854
<1226 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #7
Wrong Answer
得分:0
用时:114 ms
内存:1004 KiB

输入文件(cow7.in

100000
65 -59 66 -58
55 -6
-95 0
-31 -35
53 -71
-87 -30
59 61
-71 -72
73 50
-4 -75
63 -23
-10 36
-50
<682754 bytes omitted>

答案文件(cow7.out

52.952809179 170.188131196 98.716766560 16.970562748 154.557432691 119.151164493 136.619910701 108.2
<1356963 bytes omitted>

用户输出

52.952809179 170.188131196 98.716766560 16.970562748 154.557432691 119.151164493 136.619910701 108.226614102 70.830784268 35.057
<1358844 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #8
Wrong Answer
得分:0
用时:112 ms
内存:1108 KiB

输入文件(cow8.in

100000
15 40 16 41
47 62
-53 -39
26 -37
-69 -99
64 -87
-79 34
6 30
-100 93
-72 -68
91 -1
-68 -53
71 
<682568 bytes omitted>

答案文件(cow8.out

37.443290454 104.235310716 77.646635471 162.409975063 135.768184786 94.191294715 13.453624047 126.21
<1334522 bytes omitted>

用户输出

37.443290454 104.235310716 77.646635471 162.409975063 135.768184786 94.191294715 13.453624047 126.210142223 138.683091976 85.475
<1336493 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #9
Wrong Answer
得分:0
用时:2 ms
内存:252 KiB

输入文件(cow9.in

100
-98 1 77 54
0 -54
12 99
-79 60
30 96
41 -47
-6 -48
89 -1
-99 -15
-91 -37
-19 -83
58 57
-21 -25
5
<627 bytes omitted>

答案文件(cow9.out

55.000000000 45.000000000 6.000000000 42.000000000 48.000000000 49.000000000 12.165525061 16.0312195
<1190 bytes omitted>

用户输出

-55.000000000 -45.000000000 -6.000000000 -42.000000000 -48.000000000 -49.000000000 12.165525061 16.031219542 -38.000000000 -84.0
<1253 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #10
Wrong Answer
得分:0
用时:98 ms
内存:1476 KiB

输入文件(cow10.in

100000
13 68 92 96
-23 97
-31 -80
-61 -8
-70 40
-45 -11
43 25
21 43
-96 -28
-33 23
-50 -66
21 -60
37
<687140 bytes omitted>

答案文件(cow10.out

36.013886211 154.402072525 106.075444849 87.595661993 98.005101908 43.000000000 25.000000000 145.248
<1342024 bytes omitted>

用户输出

36.013886211 154.402072525 106.075444849 87.595661993 98.005101908 -43.000000000 -25.000000000 145.248063670 64.350602173 148.07
<1387552 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0