QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#744181#8242. V-Diagramzzisjtu#WA 99ms4044kbC++23716b2024-11-13 21:04:192024-11-13 21:04:19

Judging History

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

  • [2024-11-13 21:04:19]
  • 评测
  • 测评结果:WA
  • 用时:99ms
  • 内存:4044kb
  • [2024-11-13 21:04:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define LF(x) fixed<<setprecision(x)
void solve() {
		int n;
		long double ans=0;
		cin>>n;
		vector<long double>a(n+1);
		for(int i=1;i<=n;i++)
			cin>>a[i],ans+=a[i];
		double cnt=ans/n;
		int x=n;
		for(int i=1;i<=n;i++)
		{
			if(x>=3&&a[i]<=cnt)
			{
				x--;
				cnt=(ans-2*a[i])/x;
			}
			else break;
		}
		for(int i=n;i>=1;i--)
		{
			if(x>=3&&a[i]<=cnt)
			{
				x--;
				cnt=(ans-2*a[i])/x;
			}
			else break;
		}
		cout<<LF(10)<<cnt<<endl;

}
#undef int
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}

詳細信息

Test #1:

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

input:

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

output:

6.7500000000
5.8333333333

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 99ms
memory: 3764kb

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:

437202656.0000000000
254998762.5000000000
770302316.6666666269
608562705.0000000000
296293261.6666666865
252713443.5000000000
571816312.6666666269
140192962.5000000000
32115392.5000000000
374079296.5000000000
382950166.0000000000
779975824.3333333731
271383850.5000000000
430086448.0000000000
3585531...

result:

wrong answer 1st numbers differ - expected: '833782882.6666666', found: '437202656.0000000', error = '0.4756397'