QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#807572#9854. Find the Maximumrotcar07WA 21ms9720kbC++23634b2024-12-10 07:35:462024-12-10 07:35:47

Judging History

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

  • [2024-12-10 07:35:47]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:9720kb
  • [2024-12-10 07:35:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int N=1e5+5,B=400;
int b[N];
vector<int> e[N];
int main(){
	std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	for(int i=1;i<=n;i++) cin>>b[i];
	double mx=0;
	for(int i=1,u,v;i<n;i++){
		cin>>u>>v,e[u].push_back(v),e[v].push_back(u);
		mx=max(mx,fabs((b[u]+b[v])/2.0));
	}
	for(int i=1;i<=n;i++)if(e[i].size()>1){
		sort(e[i].begin(),e[i].end());
		mx=max(mx,fabs((b[i]+b[e[i][0]]+b[e[i][1]])/3.0));
		reverse(e[i].begin(),e[i].end());
		mx=max(mx,fabs((b[i]+b[e[i][0]]+b[e[i][1]])/3.0));
	}
	cout<<fixed<<setprecision(10)<<mx*mx/4<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3856kb

input:

2
3 2
1 2

output:

1.5625000000

result:

ok Accept!

Test #2:

score: -100
Wrong Answer
time: 21ms
memory: 9720kb

input:

100000
92267 92164 51606 26141 24879 -67311 -25229 -65514 77800 -9213 -65704 -59430 21111 94890 39508 -13162 58661 34181 -86666 -29450 1588 -18722 -75565 15211 28028 -39385 -97517 -85584 -9097 13770 31381 -21566 37697 19483 74839 -31752 -10681 -93336 -69242 46591 -76345 -15194 69484 34351 -121 91430...

output:

2310388422.2500000000

result:

wrong answer Wrong Answer!