QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#376372#2528. Mobile Robotkevinyang#WA 0ms3820kbC++17400b2024-04-04 08:57:052024-04-04 08:57:05

Judging History

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

  • [2024-04-04 08:57:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3820kb
  • [2024-04-04 08:57:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n,d;
	cin >> n >> d;
	vector<int>arr(n);
	for(int i = 0; i<n; i++){
		cin >> arr[i];
		arr[i]-=i*d;
	}
	sort(arr.begin(),arr.end());
	int v = arr[n-1]-arr[0];
	cout << v/2;
	if(v%2==0){
		cout << ".0\n";
	}
	else{
		cout << ".5\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

input:

2 1
-1 1

output:

0.5

result:

ok single line: '0.5'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2 1
0 1

output:

0.0

result:

ok single line: '0.0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

2 1
0 0

output:

0.5

result:

ok single line: '0.5'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

2 1
-10000000000000000 10000000000000000

output:

9999999999999999.5

result:

ok single line: '9999999999999999.5'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 10000000000
0 0

output:

5000000000.0

result:

ok single line: '5000000000.0'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

2 10000000000
-10000000000000000 10000000000000000

output:

9999995000000000.0

result:

ok single line: '9999995000000000.0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3512kb

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: 3612kb

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'