QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#401783#8242. V-DiagramyoungerWA 77ms3812kbC++201.1kb2024-04-29 12:56:042024-04-29 12:56:04

Judging History

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

  • [2024-04-29 12:56:04]
  • 评测
  • 测评结果:WA
  • 用时:77ms
  • 内存:3812kb
  • [2024-04-29 12:56:04]
  • 提交

answer

#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<vector>
#include<map>
#include<algorithm>

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;

const int N = 3e5 + 10;
int n , a[N] , pos;

void Asuka()
{
	cin >> n;
	cout.precision(20);
	db ans1 = 0 , ans2 = 0 , ans3 = 0;
	for(int i = 1 ; i <= n ; i ++)
		cin >> a[i];
	for(int i = 2 ; i < n ; i ++){
		if(a[i] < a[i - 1] && a[i] < a[i + 1]){
			pos = i;
			break;
		}
	}
	for(int i = 1 ; i <= pos ; i ++){
		ans1 += a[i];
	}
	ans1 = ans1 / (1.0 * pos);
	for(int i = pos ; i <= n ; i ++){
		ans2 += a[i];
	}
	ans2 = ans2 / (1.0 * (n - pos + 1));
	for(int i = 1 ; i <= n ; i ++){
		ans3 += a[i];
	}
	ans3 = ans3 / (1.0 * n);
	cout << fixed << max({ans1 , ans2 , ans3}) << '\n';
	return;
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t = 1;
	cin >> t;
	while(t --){
		Asuka();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
4
8 2 7 10
6
9 6 5 3 4 8

output:

6.75000000000000000000
5.83333333333333303727

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 77ms
memory: 3808kb

input:

100000
3
948511478 739365502 813471668
3
881046825 27458122 398507422
3
987554257 399092415 924260278
3
984128569 125199021 716360525
3
529589236 45783262 313507287
3
645443456 85994112 226010681
3
914820717 228360911 572267310
3
418958362 56703604 195276041
3
64461646 26764720 26995581
3
914535039 ...

output:

843938490.00000000000000000000
454252473.50000000000000000000
770302316.66666662693023681641
608562705.00000000000000000000
296293261.66666668653488159180
365718784.00000000000000000000
571816312.66666662693023681641
237830983.00000000000000000000
45613183.00000000000000000000
474479951.500000000000...

result:

wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'