Problem:


Score : 300 points

Problem Statement

You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i.

When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.

After you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.

Constraints

2 \leq N \leq 50

1 \leq v_i \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
v_1 v_2 \ldots v_N

Output

Print a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.

Your output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.

Sample Input 1

2
3 4

Sample Output 1

3.5

If you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.

Printing 3.50001, 3.49999, and so on will also be accepted.

Sample Input 2

3
500 300 200

Sample Output 2

375

You start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:

Use the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.

Use the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.

Use the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.

Thus, the maximum possible value of the last ingredient remaining is 375.

Printing 375.0 and so on will also be accepted.

Sample Input 3

5
138 138 138 138 138

Sample Output 3

138



Sample input:
2
3 4


Sample output:
3.5

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = list(map(int, input().split()))

for _ in range(n - 1):
    arr.sort()
    new_v = (arr[0] + arr[1]) / 2
    del arr[0:2]
    arr.append(new_v)

print(int(arr[0]))

Submission status: Wrong Answer

Solution code:
n=int(input())
v=list(map(int ,input().split()))
l=[]
draw_list=[]
second_draw=[]
for i in range(0,len(v)-1):
    first_combination=float((v[i]+v[i+1])/2)
    draw_list.append(first_combination)
    # print(draw_list)
for j in range(0,len(v)-1):
    second_combination=float((draw_list[j]+v[j])/2)
    second_draw.append(second_combination)
    # print(second_draw)

draw_list.extend(second_draw)
print(int(max(draw_list)))

Submission status: Wrong Answer

Solution code:
N = int(input())
*value, = map(int,input().split())
value.sort()

def change(lis):
    new_lis=[]
    if len(lis) % 2 == 0:
        for i in range(0,len(lis),2):
            a = (lis[i] + lis[i+1]) / 2
            new_lis.append(a)
        return  new_lis
    else:
        for i in range(0,len(lis)-1,2):
            a = (lis[i] + lis[i+1]) / 2
            new_lis.append(a)
        new_lis.append(lis[-1])    
        return  new_lis
        
while len(value) >= 2:
    value = change(value)
print(change(value)[0])

Submission status: Wrong Answer

Solution code:
n = int(input())

s = list(map(int, input().split()))

s.sort()

v = 0

print(s)

if n == 1:
  print(s[0])
  exit()
elif n == 2:
  print((s[0]+s[1])/2)
  exit()

c = (s[0]+s[1])/2

del s[0]
del s[0]

print(c)
print(s)

for i in range(n-2):
  c = (c + s[0])/2
  del s[0]
  print(c)
  
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = sorted(map(int,input().split()))
value = v[0]
for i in range(1,N):
  value=(value+v[i])/2
  print(value)
print(value)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = sorted(list(map(int, input().split())))[::-1]
s = ((L[0]+(L[-1]+L[-2])/2)/2)
print(s if len(L) > 2 else (L[0]+L[1])/2)

Submission status: Wrong Answer

Solution code:
n = int(input())
v = sorted(list(map(int,input().split())))
s = [0]*n
s[0] = v[0]

for i in range(n-1):
    s[i+1] = (v[i+1]+s[i])/2
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
value = [int(i) for i in input().split()]

now = 0
a = sorted(value) ##value.sort() だとvalueで2行目を参照してしまう？

while len(a) >= 2:
  a = sorted(a)
  print(a)
  now = (float(a[0]) + float(a[1])) / float(2)
  print(now)
  if len(a) >= 3:
    del a[0],a[0] ##a[0],a[1]にしてた
    a.append(now)
  elif len(a) == 2:
    print(now)
    break

Submission status: Wrong Answer

Solution code:
n = int(input())
value = [int(i) for i in input().split()]

now = 0
a = sorted(value)

while len(a) >= 2:
  new = sorted(a)
  
  now = (float(a[0]) + float(a[1])) / float(2)
  if len(a) >= 3:
    del a[0],a[0]
    a.append(now)
  elif len(a) == 2:
    print(now)
    break

Submission status: Wrong Answer

Solution code:
N,*V=map(int,open(0).read().split())
A=sorted(V)
for n in range(N-1):
    print(A)
    A=sorted([(A[0]+A[1])/2,]+A[2:])
print(A[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
V = sorted(list(map(int,input().split())))

ans = 0

ans += (V[0]+V[1])/2**(len(V)-1)

print(ans)

for i in range(2,N):
    ans += V[i]/2**(N-i)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()

print(v)


for i in range(N - 1):
    temp = (v[0] + v[1]) / 2
    v = v[2:]
    v.append(temp)
    v.sort()

print(v[0])

Submission status: Wrong Answer

Solution code:
# 問題：https://atcoder.jp/contests/abc138/tasks/abc138_c

n = int(input())
v = list(map(int, input().strip().split()))
v.sort(reverse=True)
res = 0
for i in range(n-1):
    res += v[i] / (2**(i+1))
res += v[-1] / (2**(n-1))

print(v)
print(res)

Submission status: Wrong Answer

Solution code:
x = int(input())
a = list(map(int,input().split()))
a.sort()
y = 0
for i in range(0,x-1):
  y += a[i]*(2**i)
print(y/(2**x))

Submission status: Wrong Answer

Solution code:
x = int(input())
a = list(map(int,input().split()))
a.sort()
y = 0
for i in range(x):
  y += a[i-0]*(2**i)
print(y/(2**(x+1)))

Submission status: Wrong Answer

Solution code:
x = int(input())
a = list(map(int,input().split()))
a.sort()
y = 0
for i in range(x):
  y += a[i-0]*(2**i)
print(y//(2**(x+1)))

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort()

for i in range(0,n-1):
  sum = int((v[i] + v[i+1])/ 2)
  v[i+1] = sum 

print(v[n-1])

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from heapq import heappop,heappush,heapify

@jit
def main(n, a):
  for _ in range(1, n):
    new = (a[1]+a[0])/2
    heappop(a)
    heappop(a)
    heappush(a, new)
  return new

n,*a = map(int,read().split())
heapify(a)
print(main(n,a))

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(n, a):
  for _ in range(1, n):
    new = (a[1]+a[0])/2
    a = np.delete(a, 0)
    a[0] = new
  return new
n = int(readline())
a = np.array(readline().split(), np.int64)
a = np.sort(a)
print(main(n,a))

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))
v.sort()
print(v)
ans=0
for i in range(N):
    ans+=(v[i])/(2**(N-i))
ans+=(v[0])/(2**N)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = list(map(int, input().split()))
v.sort()
for i in range(N-1):
    v[0] = (v[0]+v[1])/2
    v.pop(1)
print(int(*v))

Submission status: Wrong Answer

Solution code:
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)

while len(l) > 1:
  f = l.pop(0)
  s = l.pop(0)
  l.append( ( f + s ) / 2 )

print(l[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
v = sorted(list(map(int,input().split())))
ans = []
#print((sum(v[:-1])/(N-1)+v[-1])/2)

for i in range(1,N):
    v[i-1]=(v[i-1]+v[i])/2
print(min(v))

Submission status: Wrong Answer

Solution code:
N = int(input())
v = sorted(list(map(int,input().split())))

print((sum(v[:-1])/(N-1)+v[-1])/2)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = sorted(list(map(int,input().split())))
if len(m) == 2:
    print(sum(m) / 2)
    exit()
y = m[n-1] / 2
m.pop(-1)
x = sum(m) / (len(m)*2)
print(x + y)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = list(map(int, input().split()))
while True:
    if len(v) == 1:
        print(v[0])
        break
    s = sum(v)
    t = (-1, -1, 0)
    for i in range(len(v)):
        for j in range(i, len(v)):
            x = s - v[i]/2 - v[j]/2
            if x > t[2]:
                t = (i, j, x)
    x = v.pop(i)
    y = v.pop(j-1)
    v.append((x+y)/2)

Submission status: Wrong Answer

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort(reverse=True)
V = iter(V)
res = 0
L = N.bit_length()
for i in range(L):
    if (N>>i)&1 != 1:
        continue
    for _ in range(1<<i):
        v = next(V)
        res += v/(1<<(i+2-(N&-N)))

print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort(reverse=True)
V = iter(V)
res = 0
L = N.bit_length()
for i in range(L):
    if (N>>i)&1 != 1:
        continue
    for _ in range(1<<i):
        v = next(V)
        res += v/(1<<(i+1))

print(res)

Submission status: Wrong Answer

Solution code:
N=int(input())
*v,=sorted(map(int,input().split()))

from bisect import insort
c=1
while c<N:
    #print(c,v)
    insort(v,(v.pop(0) + v.pop(0)) / 2)
    #print(c,v)
    c+=1
print(v)

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
v = LI()

v.sort

ans = 0
for i in range(N-1):
    ans += v[i]/2**(i+1)
ans += v[N-1]/2**(N-1)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
v = [int(i) for i in input().split()]
ans=v[0]
for i in range(1,N):
    ans = (ans+v[i])/2
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
a=sorted(a)
while(len(a)>1):
    d=(a[0]+a[1])/2
    a.append(d)
    a.pop(0)
    a.pop(0)
    if(len(a)==1):
        break
print(a[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()
ans = 0

for i in range(N - 1):
    v1 = v.pop(0)
    v2 = v.pop(0)
    vv = (v1 + v2) / 2
    v.insert(0, vv)
print(int(v[0]))

Submission status: Wrong Answer

Solution code:
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
s=(L[0]+L[1])/2
for i in range(2,N):
  s=(s+L[i])//2
print(s)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

if __name__=='__main__':
    n = I()
    v = list(IL())
    v.sort(reverse=True)
    while 1<len(v):
        tmp = v.pop()+v.pop()
        v.append(tmp/2)
        v.sort()
    print(v.pop())
    exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int,input().split()))
S = 0
for i in range(len(T)):
    list.sort(T, reverse=False)
    S = (T[0]+T[1])/2
    T.append(S)    
    T.pop(0)
    T.pop(0)
    print(T[0])
    if len(T) ==1:break

Submission status: Wrong Answer

Solution code:
N = int(input())
T = list(map(int,input().split()))
S = 0
for i in range(len(T)):
    list.sort(T, reverse=False)
    S = (T[0]+T[1])/2
    print(T[0])
    print(T[1])
    T.append(S)    
    T.pop(0)
    T.pop(0)
    print(T)
    if len(T) ==1:break

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int, input().split()))

v.sort()

for _ in range(n - 2):
  v.append((v[0] + v[1]) / 2)
  del v[0], v[1]
  v.sort()
  
print(sum(v) / 2)

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int, input().split()))

v.sort()

for _ in range(n - 2):
  v.insert(0, (v[0] + v[1]) / 2)
  del v[1], v[2]
  
print(sum(v) / 2)

Submission status: Wrong Answer

Solution code:
from collections import deque
n = int(input())
v = list(map(int,input().split()))
v.sort()
ans = 0
v = deque(v)
while(len(v) > 1):
    v.append(((v.popleft()+v.popleft())/2))
print(v[0])
128
149

Submission status: Wrong Answer

Solution code:
N = int(input())
v = sorted(list(map(int,input().split())))
ans = v[0]
print(v)
for i in range(1,N):
    ans = (ans + v[i])/2
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
v = list(map(int,input().split()))
v.sort()
ans,tmp = [],[]
gab = (v[0]+v[1])/2
tmp.append(gab)
if n == 2:
  print(tmp[0])
  sys.exit()
for i in range(2,n):
  j = 0
  tmp.append((v[i] +tmp[j])/2)
  j += 1
print(tmp[-1])

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

n = k()
v = l()
v.sort()

while len(v) != 1:
    x = (v[0]+v[1])/2
    v.append(x)
    del v[0]
    del v[0]

print(v[0])

Submission status: Wrong Answer

Solution code:
n = int(input())
v = sorted(list(map(int,input().split())))

for _ in range(n-1):
    x = v[0]
    y = v[1]
    num = (x+y)/2
    del v[0]
    v[0] = num

print(int(v[0]))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(float, input().split()))

while len(A) > 1:
  x = A[-1]
  A.pop()
  y = A[-1]
  A.pop()
  A.append((x + y) / 2)

print(A[0])

Submission status: Wrong Answer

Solution code:
n =int(input())
v = list(map(int, input().split()))

sum = v[0]
for i in range(n - 1):
    sum += (sum + v[i +1]) / 2
    
print(sum)

Submission status: Wrong Answer

Solution code:
import itertools
n=int(input())
a=[int(i) for i in input().split()]

suma=set()
for i in  itertools.combinations(a,2):
    s=sum(i)
    suma.add(s/2)

print(max(suma))

Submission status: Wrong Answer

Solution code:
A=int(input())
B=list(map(int, input().split()))
print(sum(B)/2-max(B)/2)

Submission status: Wrong Answer

Solution code:
N=int(input())
v=list(map(int,input().split()))

v.sort()
for i in range(N-1):
  A=(v[0]+v[1])/2
  del v[0]
  del v[0]
  v.insert(0,A)
  
print(v)

Submission status: Wrong Answer

Solution code:
def average(x,y):
    return (x+y)/2
N=int(input())
v=list(map(int,input().split()))
v.sort(reverse=True)
for j in range(N-1):
    min=1001
    for i in range(N-1-j):
        if v[i]-v[i+1]<min:
            min=v[i]-v[i+1]
            mini=i
    v[mini]=average(v[mini],v[mini+1])
    v.pop(mini+1)
    v.sort(reverse=True)
print(v[mini])

Submission status: Wrong Answer

Solution code:
def average(x,y):
    return (x+y)/2
N=int(input())
v=list(map(int,input().split()))
v.sort(reverse=True)
for j in range(N-1):
    min=1001
    for i in range(N-1-j):
        if v[i]-v[i+1]<min:
            min=v[i]-v[i+1]
            mini=i
    v[mini]=average(v[mini],v[mini+1])
    v.pop(mini+1)
print(v[mini])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
s=0
for i in range(n):
  s=(s+b[i])/2
print(s)

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    v = list(map(int, input().split()))
    V = sorted(v)
    one = (V[0]+V[1])/2
    ans = [one]
    for i in range(2, N):
        ans.append((one+V[i])/2)
    print(ans[-1])
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    v = list(map(int, input().split()))
    V = sorted(v)
    one = (V[0]+V[1])/2
    ans = [one]
    for i in range(2, N):
        ans.append((one+V[i])/2)
    print(max(ans))
resolve()

Submission status: Wrong Answer

Solution code:
N = int(input())
vn = sorted(list(map(int,input().split())))
for n in range(N-2):
  vn[n+1] = vn[n]+vn[n+1]
  vn[n+2] = 2*vn[n+2]
vn[N-1] = vn[N-1]+vn[N-2]
print(vn[N-1]/(pow(2,-(-N//2))))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]


N = int(input())
V = list(map(int, input().split()))

V.sort()
tmp = round((V[0]+V[1])/2,5)
for i in range(2,N):
    print(i,tmp)
    tmp = round((tmp + V[i])/2,5)

print(tmp)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]


N = int(input())
V = list(map(int, input().split()))

V.sort()
tmp = round((V[0]+V[1])/2,1)
for i in range(2,N):
    print(i,tmp)
    tmp = round((tmp + V[i])/2,1)

print(tmp)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]


N = int(input())
V = list(map(int, input().split()))

V.sort()
tmp = (V[0]+V[1])/2
for i in range(2,N):
    print(i,tmp)
    tmp = (tmp + V[i])/2

print(tmp)

Submission status: Wrong Answer

Solution code:
N = int(input())
Vs = list(map(int, input().split()))

Vs.sort()

print(Vs)

initialGousei = (Vs[0] + Vs[1]) / 2

for i in range(2, N):
    initialGousei = (initialGousei + Vs[i]) / 2

print(initialGousei)

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: str(sys.stdin.buffer.readline().rstrip())
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
a = rl()
def heapsort(l):
  li = []
  for v in l:
    heapq.heappush(li, v)
  return [heapq.heappop(li) for _ in range(len(li))]
a = heapsort(a)
print(a)
ans = a[0]
for i in a:
  ans = (ans + i)/2
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
v= list(map(int,input().split()))
c=[0]*(n)
v.sort()
print(v)
ans=0
c[0]=v[0]
for i in range(1,n):
    c[i]=(c[i-1]+v[i])/2
print(c[n-1])

Submission status: Wrong Answer

Solution code:
n = int(input())

lis = list(map(int, input().split()))

lis = sorted(lis)

if len(lis) == 2:
    print((lis[0]+lis[1])/2)
    exit()
else:
    a = (lis[n-2]+lis[n-3])/2
    ans = (a+lis[n-1])/2
    
print(ans)

Submission status: Wrong Answer

Solution code:
import heapq
n = raw_input()
heap = [x*(-1) for x in map(float, raw_input().split(' '))]
heapq.heapify(heap)
while(len(heap)>1):
	u,v = heapq.heappop(heap), heapq.heappop(heap)
	u*=-1
	v*=-1
	w = 0.5*(u+v)
	heapq.heappush(heap, -w)


print -heap[0]

Submission status: Wrong Answer

Solution code:
# ABC 138 C
N =int(input())
V = sorted([int(i) for i in input().split()])
ans = 0

for i,v in enumerate(V):
    if i<2:
        ans +=v/(2**(N-1))
    else:
        ans += v/(2**(i-1))
print(ans)

Submission status: Wrong Answer

Solution code:
n,*v=3,10,10,10
v.sort()
print(sum(v[i]<<i+(i==0)for i in range(n))/2**n)

Submission status: Wrong Answer

Solution code:
N = int(input())
V = list(map(int, input().split()))

V.reverse()
ans = V[0]
for i in range(1, N):
  ans = (ans + V[i])/2
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
V = [int(i) for i in input().split()]

V.sort()
print(V)

ans = 0

for i in range(N):
	if i == 0 or i == 1:
		ans += V[i] / (2**(N-1))
	else:
		ans += V[i] / (2**(N-i))

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()

N = I()
v = LI()

v = sorted(v,reverse=True)

ans = 0

for i in range(N-1):
    ans += v[i]/(2**(i+1))

print(ans + v[N-1]//(2**(N-1)))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
n=int(input())
v=[int(x) for x in input().split()]

v=sorted(v)

def A(l):
    if len(l)==1:
        print(l[0])
    else:
        v_new=[]
        if len(l)%2==0:
            for i in range(0,len(l)-1,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new=sorted(v_new)
            A(v_new)
        else:
            for i in range(0,len(l)-2,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new.append(l[-1])
            v_new=sorted(v_new)
            A(v_new)

A(v)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
n=int(input())
v=[int(x) for x in input().split()]

v=sorted(v)

def A(l):
    if len(l)==1:
        print(l[0])
    else:
        v_new=[]
        if len(l)%2==0:
            for i in range(0,len(l)-1,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new=sorted(v_new)
            print(v_new)
            A(v_new)
        else:
            for i in range(0,len(l)-2,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new.append(l[-1])
            v_new=sorted(v_new)
            print(v_new)
            A(v_new)

A(v)

Submission status: Wrong Answer

Solution code:
n=int(input())
v=[int(x) for x in input().split()]

v=sorted(v)

def A(l):
    if len(l)==1:
        print(l[0])
    else:
        v_new=[]
        if len(l)%2==0:
            for i in range(0,len(l)-1,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new=sorted(v_new)
            A(v_new)
        else:
            for i in range(0,len(l)-2,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new.append(l[-1])
            v_new=sorted(v_new)
            A(v_new)

A(v)

Submission status: Wrong Answer

Solution code:
n=int(input())
v=[int(x) for x in input().split()]

v=sorted(v)

def A(l):
    if len(l)==1:
        print(l[0])
    else:
        v_new=[]
        if len(l)%2==0:
            for i in range(0,len(l)-1,2):
                v_new.append((l[i]+l[i+1])/2)
            A(v_new)
        else:
            for i in range(0,len(l)-2,2):
                v_new.append((l[i]+l[i+1])/2)
            v_new.append(l[-1])
            A(v_new)

A(v)

Submission status: Wrong Answer

Solution code:
def qsort(seq, left, right):
    #[再帰の終了条件は？]
    if left == right: return seq
    elif left+1 == right:
        if seq[left]>seq[right]:
          seq[left],seq[right] = seq[right], seq[left]
        return seq

    med = (left+right)//2
    pivot = seq[med] #[与えられた範囲の真ん中に位置する要素]
    #カーソルを⽤意
    cur_l = left
    cur_r = right
    
    #このwhile文で並べ替え終わらせる
    while True:
        #[左カーソル（cur_l）をpivotより⼤きい要素まで進める]
        while seq[cur_l] <= pivot:
          if cur_l >= cur_r:
            break
          cur_l += 1
        
        #[右カーソル（cur_r）をpivotより⼩さい要素まで進める]
        while seq[cur_r] > pivot:
            if cur_r <= cur_l:
              break
            cur_r -= 1
        # カーソル交差でループ終了
        if (cur_r <= cur_l): 
          break
        # cur_l < cur_rだが，左側にpivotより⼤きい要素，右側にpivotより⼩さい要素がそれぞれ⾒つかった．
        #[cur_rの要素とcur_lの要素を⼊れ替える]
        seq [cur_l], seq[cur_r] = seq[cur_r], seq[cur_l]
        cur_l += 1
        cur_r -= 1
    print(seq)
    cut = -1
    if cur_l == cur_r:
        #print('pp')
        if seq[cur_l] < pivot:
            #print('qq')
            cut = cur_l
        else:
            #print('rr')
            cut = cur_l-1
    elif cur_l == cur_r+1:
        #print('ss')
        cut = cur_r
    print(cut)

    # このwhileループを抜けるということは，左右の要素の⼊れ替えが完了したこと．
    # 分割したグループそれぞれに対して，qsortを実⾏したい！ -> 再帰
    #[左側だけでqsort]
    qsort(seq,left,cut)
    #[右側だけでqsort]
    qsort(seq,cut+1,right)
    # どんな引数を与えれば良い？
    return 0

Submission status: Wrong Answer

Solution code:
N = int(input())
D = sorted([int(i) for i in input().split()])
D = [D[i]*2**max(0,i-1) for i in range(N)]
print(D)
print(sum(D)/2**(N-1))

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int, input().split()))

vs = sorted(v)
ans = vs[0]
for i in range(1,n):
    ans = (ans + vs[i]) // 2

print(ans)

Submission status: Wrong Answer

Solution code:
import heapq

N = int(input())
V = []
for v in map(int, input().split()):
    heapq.heappush(V, v)

while len(V) > 2:
    a, b = heapq.heappop(V), heapq.heappop(V)
    heapq.heappush(V, (a + b) // 2)
print((heapq.heappop(V) + heapq.heappop(V)) / 2)

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort(reverse=True)
if n == 2:
    print((v[0]+v[1])/2)
else:
    for i in range(n-1):
        p = (v[-1] + v[-2])/2
        v.pop(-1)
        v.pop(-1)
        v.append(p)
        v.sort()
    print(v[0])

Submission status: Wrong Answer

Solution code:
import itertools
import math
import fractions
import functools
n = int(input())
v = list(map(int, input().split()))
v.sort()
print(v)

sum = (v[0] + v[1])/2
for i in range(2,n):
    sum = (sum + v[i])/2

print(sum)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
print(max(l))

Submission status: Wrong Answer

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    N,=pin()
    v=lispin()
    V=[v_*2 for v_ in v]
    V.sort()
    ans=V[0]
    for i in range(1,N):
        ans=(ans+V[i])/2
        print(ans/2)

#%%submit!    
resolve()

Submission status: Wrong Answer

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    N,=pin()
    v=lispin()
    V=[v_*2 for v_ in v]
    V.sort()
    ans=V[0]
    for i in range(1,N):
        ans=(ans+V[i])//2
    print(ans/2)
    
resolve()

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort(reverse=True)
ans = v[0]
for i in range(1,n):
    ans = (ans+v[i])/2

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
v=[]
v+=list(map(int,input().split()))
v.sort()
l=len(v)
result=v[0]/(2**(l-1))
for i in range(1,n):
  result=result+v[i]/(2**(l-i))
print(int(result))

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        p = (v[i] + v[j]) / 2
        for k in range(n):
            if k == i or k == j: continue
            p = (p + v[k]) / 2
        ans = max(ans, p)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import combinations, permutations
N = int(input())
#N,K = map(int,input().split())
#N = int(input())
V = list(map(int,input().split()))
s=0
S=[]
for C in combinations(V,2):
    n=N
    v=V.copy()
    v.remove(C[0])
    v.remove(C[1])
    s=(C[0]+C[1])/2**(n-1)
    n-=2
    #print(C,s)
    for D in combinations(v,len(v)):
        for i in range(len(v)):

            s+=D[i]/2**n
            n-=1
            #print(D,s)
        S.append(s)
print(max(S))

Submission status: Wrong Answer

Solution code:
N = int(input())
v = list(map(int,input().split()))
V = sorted(v)

while len(V) > 1:
    V.append((V.pop(0) + V.pop(0)) // 2)
    V = sorted(V)

print(*V)

Submission status: Wrong Answer

Solution code:
n=int(input())
v=sorted(list(map(int,input().split())))
ans=v[0]
for i in range(1,n):
    ans=(ans+v[i])//2
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
v=sorted(list(map(int,input().split())))
ans=v[0]
for i in range(n-1):
    ans=(ans+v[i+1])//2
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
v = list(map(int,input().split()))

v.sort()

value = v[0]

for i in range(1,n):
    value = (value+v[i])//2

print(value)

Submission status: Wrong Answer

Solution code:
N = int(input())
v_list = sorted(list(map(int,input().split())))
print(v_list)

sum = 0
a = 0

if N == 1:
    sum += v_list[0]

elif N == 2:
    sum += (v_list[0] + v_list[1])/2

else:
    a = v_list[0] + v_list[1]
    for i in range(N-1):
        sum += a *2 ** (-N + i +1)
     
print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
vi = list(map(int,input().split()))
if n%2 == 0:
    mean = sum(vi)/len(vi)
    print(mean)
else:
    vi.sort()
    saidai = vi.pop(-1)
    mean = sum(vi)/len(vi)
    ans = (mean+saidai)/2
    print(ans)

Submission status: Wrong Answer

Solution code:
import re

n = int(input())
v = sorted(list(map(int, input().split())))

ans = (v[0]+v[1])/2

def del0(x):

    x = str(x)

    if re.search(r'\.0.+', x):
        return float(x)
    
    elif re.search(r'\.0', x):
        x = x.replace(r'.0', '')
        return int(x)
    else:
        return float(x)

if n == 2:
    ans = ans
    print(del0(ans))

elif n > 2 and n % 2 == 0:
    for i in range(int(n/2)):
        ans = (ans + v[i+2])/2
    print(del0(ans))

elif n % 2 != 0:
    for i in range(n-2):
        ans = (ans + v[i+2])/2
    print(del0(ans))