QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#463938#2528. Mobile Robotyzkkai#WA 0ms3872kbC++20592b2024-07-05 16:23:402024-07-05 16:23:40

Judging History

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

  • [2024-07-05 16:23:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3872kb
  • [2024-07-05 16:23:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
inline void solve() {
    int n;
    LL d;
    cin >> n >> d;
    
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= i * d;
    }
    sort(a.begin(), a.end());
    
    LL res = a[n - 1] - a[0];
    cout << res / 2;
    if (res % 2 == 1) {
        cout << ".5";
    } else {
        cout << ".0";
    }
    cout << '\n';

    
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;

    while (t--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

2 1
-1 1

output:

0.5

result:

ok single line: '0.5'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

2 1
0 1

output:

0.0

result:

ok single line: '0.0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

2 1
0 0

output:

0.5

result:

ok single line: '0.5'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

2 1
-10000000000000000 10000000000000000

output:

9999999999999999.5

result:

ok single line: '9999999999999999.5'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

2 10000000000
0 0

output:

5000000000.0

result:

ok single line: '5000000000.0'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

2 10000000000
-10000000000000000 10000000000000000

output:

9999995000000000.0

result:

ok single line: '9999995000000000.0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

10 1
0 1 2 3 4 5 6 7 8 9

output:

0.0

result:

ok single line: '0.0'

Test #8:

score: -100
Wrong Answer
time: 0ms
memory: 3524kb

input:

10 1
9 8 7 6 5 4 3 2 1 0

output:

9.0

result:

wrong answer 1st lines differ - expected: '0.0', found: '9.0'