QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#376356 | #2528. Mobile Robot | FOY# | WA | 0ms | 3628kb | C++23 | 448b | 2024-04-04 08:29:10 | 2024-04-04 08:29:11 |
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;
vals.resize(n);
ll lo = 1e18, hi = -1e18;
for (int i = 0; i < n; i++) {
cin >> vals[i];
lo = min(lo, vals[i]-i*d);
hi = max(hi, vals[i]-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: 3616kb
input:
2 1 -1 1
output:
0.5
result:
ok single line: '0.5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
2 1 0 1
output:
0.0
result:
ok single line: '0.0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 1 0 0
output:
0.5
result:
ok single line: '0.5'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 1 -10000000000000000 10000000000000000
output:
9999999999999999.5
result:
ok single line: '9999999999999999.5'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3560kb
input:
2 10000000000 0 0
output:
1073741823.5
result:
wrong answer 1st lines differ - expected: '5000000000.0', found: '1073741823.5'