编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5707 #1059. 牛车采矿 Accepted 100 627 ms 1244 K C++ 17 / 1.3 K t330026189 2024-08-17 14:36:02
显示原始代码
#include <bits/stdc++.h>
#define LL long long

using namespace std;

#define il inline

#define rd read()

#define int long long


const int L = 1e5 + 10, lim = 1e6, inf = 1e9, mod = 1e9 + 7;
int n;
double X1, Y1, X2, Y2, dis[L];

il double cul(double x, double y) {
    double ans = sqrt(x * x + y * y);
    return ans;
}

il int read() {
    int res = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        res = res * 10 + c - 48;
        c = getchar();
    }
    return res * f;
}

signed main(void) {
    n = rd;
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> X1 >> Y1 >> X2 >> Y2;
    double x, y;
    for (int i = 1; i <= n; ++i) {
        cin >> x >> y;
        if (X1 <= x && x <= X2)
            dis[i] = min(abs(y - Y1), abs(y - Y2));
        else if (Y1 <= y && y <= Y2)
            dis[i] = min(abs(x - X1), abs(x - X2));
        else {
            int xx = min(abs(x - X1), abs(x - X2)), yy = min(abs(y - Y1), abs(y - Y2));
            dis[i] = cul(xx, yy);
        }
    }
    double minn = inf;
    int k = 0;
    for (int i = 1; i <= n; ++i) {
        printf("%.9lf ", dis[i]);
        if (dis[i] < minn)
            minn = dis[i], k = i;
    }
    printf("\n%lld\n", k);
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:3 ms
内存:420 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
<1205 bytes omitted>

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:4 ms
内存:408 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.
<1246 bytes omitted>

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:126 ms
内存:1112 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
<1350259 bytes omitted>

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:124 ms
内存:1228 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
<1333930 bytes omitted>

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:3 ms
内存:312 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
<1233 bytes omitted>

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:3 ms
内存:404 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.8542
<1222 bytes omitted>

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:126 ms
内存:1176 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
<1356935 bytes omitted>

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:125 ms
内存:1220 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
<1334494 bytes omitted>

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:3 ms
内存:316 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.000000000
<1162 bytes omitted>

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:110 ms
内存:1244 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.0709
<1341996 bytes omitted>

系统信息

Exited with return code 0