QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#376360 | #2528. Mobile Robot | FOY# | WA | 0ms | 3692kb | C++23 | 398b | 2024-04-04 08:33:36 | 2024-04-04 08:33:37 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
using ld = long double;
using ll = long long;
int main() {
ll n, d; cin >> n >> d;
ll lo = 1e18, hi = -1e18;
for (ll i = 0; i < n; i++) {
ll x; cin >> x;
lo = min(lo, x-i*d);
hi = max(hi, x-i*d);
}
ll val = hi-lo;
if (val%2) {
cout << val/2 << ".5" << endl;
}
else cout << val/2 << ".0" << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
2 1 -1 1
output:
0.5
result:
ok single line: '0.5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 1 0 1
output:
0.0
result:
ok single line: '0.0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 1 0 0
output:
0.5
result:
ok single line: '0.5'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3612kb
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: 3692kb
input:
2 10000000000 -10000000000000000 10000000000000000
output:
9999995000000000.0
result:
ok single line: '9999995000000000.0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3616kb
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: 3668kb
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'