QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741344 | #2528. Mobile Robot | NMK# | WA | 1ms | 3796kb | C++17 | 630b | 2024-11-13 14:08:33 | 2024-11-13 14:08:38 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'