QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#234785#2528. Mobile RobotNYCU_gAwr_gurA#WA 0ms3684kbC++20635b2023-11-01 22:24:112023-11-01 22:24:11

Judging History

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

  • [2023-11-01 22:24:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2023-11-01 22:24:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#define fast
#else
#define fast cin.tie(0)->sync_with_stdio(0)
#define endl '\n'
#define cerr if(1);else cerr
#endif
#define _ <<' '<<
#define ALL(v) v.begin(),v.end()
#define ft first
#define sd second

using ll = long long;
using ld = long double;
using pii = pair<int,int>;

signed main() {
    fast;

    ll n,d;
    cin>>n>>d;
    ll l, r;
    l=1e18, r=-1e18;
    for(ll i=0;i<n;i++)
    {
        ll a;
        cin>>a;
        a-=i*d;
        l=min(l, a);
        r=max(r, a);
    }
    cout<<(r-l)/2<<'.'<<(r-l)%2*5<<'\n';

    cerr _ "meow" _ endl;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1
-1 1

output:

0.5

result:

ok single line: '0.5'

Test #2:

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

input:

2 1
0 1

output:

0.0

result:

ok single line: '0.0'

Test #3:

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

input:

2 1
0 0

output:

0.5

result:

ok single line: '0.5'

Test #4:

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

input:

2 1
-10000000000000000 10000000000000000

output:

9999999999999999.5

result:

ok single line: '9999999999999999.5'

Test #5:

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

input:

2 10000000000
0 0

output:

5000000000.0

result:

ok single line: '5000000000.0'

Test #6:

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

input:

2 10000000000
-10000000000000000 10000000000000000

output:

9999995000000000.0

result:

ok single line: '9999995000000000.0'

Test #7:

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

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

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'