QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#727348#8242. V-Diagramveg#WA 1ms7984kbC++14682b2024-11-09 12:53:052024-11-09 12:53:06

Judging History

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

  • [2024-11-09 12:53:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7984kb
  • [2024-11-09 12:53:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define ll long long

const int maxn=3e5+10;

int pre[maxn];
int nxt[maxn];
int a[maxn];
ll sum[maxn];

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n;
		scanf("%d",&n);
		for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum[i]=sum[i-1]+a[i];
		pre[1]=nxt[n]=0;
		for(int i=2;i<=n;i++)
			if(a[i]<a[i-1]) pre[i]=pre[i-1]+1;
			else pre[i]=0;
		for(int i=n-1;i;i--)
			if(a[i]<a[i+1]) nxt[i]=nxt[i+1]+1;
			else nxt[i]=0;
		double ans=0;
		for(int i=1;i<=n;i++)
			if(pre[i]&&nxt[i])
				ans=max(ans,1.0*(sum[i+nxt[i]]-sum[i-pre[i]-1])/(pre[i]+nxt[i]+1));
		printf("%.6f\n",ans);		
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7984kb

input:

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

output:

6.750000
5.833333

result:

wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.8333330', error = '0.0000001'