QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#376358 | #2528. Mobile Robot | FOY# | WA | 1ms | 3596kb | C++23 | 417b | 2024-04-04 08:30:07 | 2024-04-04 08:30:07 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
using ld = long double;
using ll = long long;
vector<ll> vals;
int main() {
int 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: 1ms
memory: 3588kb
input:
2 1 -1 1
output:
0.5
result:
ok single line: '0.5'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
2 1 0 1
output:
0.0
result:
ok single line: '0.0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
2 1 0 0
output:
0.5
result:
ok single line: '0.5'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
2 1 -10000000000000000 10000000000000000
output:
9999999999999999.5
result:
ok single line: '9999999999999999.5'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3592kb
input:
2 10000000000 0 0
output:
1073741823.5
result:
wrong answer 1st lines differ - expected: '5000000000.0', found: '1073741823.5'