QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741344#2528. Mobile RobotNMK#WA 1ms3796kbC++17630b2024-11-13 14:08:332024-11-13 14:08:38

Judging History

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

  • [2024-11-13 14:08:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3796kb
  • [2024-11-13 14:08:33]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n;
ll d,a[1000005];
long long llINF = 1e18;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> d;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    ll mx = -llINF, mn = llINF;
    for(int i = 1;i <= n;i++) {
        mx = max(mx,a[i]+d*i), mn = min(mn,a[i]+d*i);
    }
    ld ans = (mx-mn)/2.0l;
    mx = -llINF, mn = llINF;
    for(int i = 1;i <= n;i++) {
        mx = max(mx,a[i]-d*i), mn = min(mn,a[i]-d*i);
    }
    ans = min(ans,(mx-mn)/2.0l);
    cout << ans;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3796kb

input:

2 1
-1 1

output:

0.5

result:

ok single line: '0.5'

Test #2:

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

input:

2 1
0 1

output:

0

result:

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