QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#378266#8242. V-DiagramPZhengWA 1ms3748kbC++14651b2024-04-06 10:35:102024-04-06 10:35:10

Judging History

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

  • [2024-04-06 10:35:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3748kb
  • [2024-04-06 10:35:10]
  • 提交

answer

#include <iostream>
#include <vector>

using namespace std;
using i64 = long long;

void solve() {
	int n;
	cin >> n;
	vector<i64> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	double ans = 0;
	int cur1 = 0, cur2 = 1, sums = 0;
	sums += a[0];
	bool flag = (a[1] >= a[0]);
	while(cur2 != n) {
		while(cur2 != n && ((a[cur2] < a[cur2 - 1]) ^ flag)) {
			sums += a[cur2];
			cur2++;
		}
		flag ^= 1;
		if(flag == 0) {
			ans = max(double(sums) / (cur2 - cur1), ans);
			cur1 = cur2 - 1;
			sums = 0;
		}
 	}
 	cout << ans << endl;
}

int main() {
	int t;
	cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}

詳細信息

Test #1:

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

input:

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

output:

6.75
5.83333

result:

wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.8333300', error = '0.0000006'