https://pintia.cn/problem-sets/994805342720868352/problems/994805350316752896
用小根堆即可。
#include<bits/stdc++.h>
using namespace std;
int n,x;
priority_queue<double,vector<double>,greater<double>>heap;
int main(void)
{
int n; cin>>n;
while(n--) cin>>x,heap.push(x);
while(heap.size()>=2)
{
auto a=heap.top(); heap.pop();
auto b=heap.top(); heap.pop();
heap.push((a+b)/2);
}
printf("%d\n",(int)heap.top());
return 0;
}