QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789229#115. Fences_8_8_#0 1ms3856kbC++23927b2024-11-27 19:36:462024-11-27 19:36:46

Judging History

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

  • [2024-11-27 19:36:46]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3856kb
  • [2024-11-27 19:36:46]
  • 提交

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 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 << 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;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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: 0ms
memory: 3824kb

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: 1ms
memory: 3796kb

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: 3812kb

input:

1 80
-17 134 -3 128

output:

640.0000000

result:

ok found '640.00000', expected '640.00000', error '0.00000'

Test #5:

score: 0
Wrong Answer
time: 1ms
memory: 3816kb

input:

1 100
102 170 -78 186

output:

800.0000000

result:

wrong answer 1st numbers differ - expected: '758.77677', found: '800.00000', error = '0.05433'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%