QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#807571 | #9854. Find the Maximum | rotcar07 | WA | 31ms | 9832kb | C++23 | 543b | 2024-12-10 07:35:06 | 2024-12-10 07:35:13 |
Judging History
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));
}
cout<<fixed<<setprecision(10)<<mx*mx/4<<'\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3796kb
input:
2 3 2 1 2
output:
1.5625000000
result:
ok Accept!
Test #2:
score: -100
Wrong Answer
time: 31ms
memory: 9832kb
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!