QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356067#8242. V-Diagramucup-team2681#WA 53ms3896kbC++20861b2024-03-17 15:21:462024-03-17 15:21:51

Judging History

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

  • [2024-03-17 15:21:51]
  • 评测
  • 测评结果:WA
  • 用时:53ms
  • 内存:3896kb
  • [2024-03-17 15:21:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int maxn=3e5+5;
inline int read() {
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*f;
}
typedef long long ll;
typedef long double lb;
int T,n,a[maxn];
int main() {
	T=read();
	while(T--) {
		n=read();
		int p=0,Min=2e9;
		for(int i=1;i<=n;++i) {
			a[i]=read();
			if(a[i]<Min) {
				Min=a[i];
				p=i;
			}
		}
		ll res=a[p]+a[p-1]+a[p+1];
		ll sum1=0,sum2=0;
		int now1=p-2,now2=n-p-1;
		for(int i=1;i<=now1;++i) sum1+=a[i];
		for(int i=p+2;i<=n;++i) sum2+=a[i];
		lb ans=(lb)(sum1+sum2+res)/(lb)n;
		ans=max(ans,(lb)(sum1+res)/(lb)(now1+3));
		ans=max(ans,(lb)(sum2+res)/(lb)(now2+3));
		printf("%.15Lf\n",ans);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

6.750000000000000
5.833333333333333

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 53ms
memory: 3848kb

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:

-597872882.666666666686069
435670789.666666666656965
-661353448.666666666686069
608562705.000000000000000
296293261.666666666656965
319149416.333333333343035
571816312.666666666686069
223646002.333333333328483
39407315.666666666667879
383253737.666666666656965
-697292126.666666666686069
-651679941.0...

result:

wrong answer 1st numbers differ - expected: '833782882.6666666', found: '-597872882.6666666', error = '1.7170606'