QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789240#115. Fences_8_8_#0 1ms3904kbC++23981b2024-11-27 19:38:282024-11-27 19:38:35

Judging History

你现在查看的是最新测评结果

  • [2024-11-27 19:38:35]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3904kb
  • [2024-11-27 19:38:28]
  • 提交

answer

#include <bits/stdc++.h> 

using namespace std;

typedef long long ll;
typedef long double ld;


const int N = (int)3e3 + 12, MOD = (int)1e9 + 7;


int n, s;

struct pt{
    int x, y;
};
void in(pt &a) {
    cin >> a.x >> a.y;
}
vector<array<pt, 2>> a;

ld dist(pt a, pt b) {
    ld x = (a.x - b.x) ,y = (b.x - a.y);
    return sqrtl(x * x + y * y);
}
ld get(pt x, pt y) {
    return min(dist(a[0][0], x) + dist(a[0][1], y), dist(a[0][1], x) + dist(a[0][0], y)) + s * 4;
}
void test() {
    cin >> n >> s;
    a.resize(n);
    for(int i = 0; i < n; i++) {
        in(a[i][0]);in(a[i][1]);
    }
    ld res = s * 8;
    res = min({res, get({-s, -s}, {s, s}), get({-s, s}, {s, -s})});
    // cout << get({-s, -s}, {s, s}) << '\n';
    cout << fixed << setprecision(7) << res << '\n';
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
    // cin >> t;

    while(t--) 
        test();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 18
Accepted
time: 1ms
memory: 3832kb

input:

1 20
-132 -148 7 -48

output:

160.0000000

result:

ok found '160.00000', expected '160.00000', error '0.00000'

Test #2:

score: 18
Accepted
time: 1ms
memory: 3876kb

input:

1 40
40 81 118 181

output:

320.0000000

result:

ok found '320.00000', expected '320.00000', error '0.00000'

Test #3:

score: 18
Accepted
time: 0ms
memory: 3856kb

input:

1 60
-189 -95 -114 -101

output:

480.0000000

result:

ok found '480.00000', expected '480.00000', error '0.00000'

Test #4:

score: 18
Accepted
time: 0ms
memory: 3904kb

input:

1 80
-17 134 -3 128

output:

638.9608364

result:

ok found '638.96084', expected '640.00000', error '0.00162'

Test #5:

score: 18
Accepted
time: 0ms
memory: 3868kb

input:

1 100
102 170 -78 186

output:

756.8734714

result:

ok found '756.87347', expected '758.77677', error '0.00251'

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 3900kb

input:

1 120
111 175 178 151

output:

920.4459300

result:

wrong answer 1st numbers differ - expected: '960.00000', found: '920.44593', error = '0.04120'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%