Submission

Status:

Compilation Error

Subtask/Task Score:

Score: 0

User: tull

Problemset: วิศวกรรมข้อมูล

Language: cpp

Time: 0.000 second

Submitted On: 2026-07-30 22:14:33

from itertools import permutations
n=int(input())
a=list(map(int,input().split()))
l=0
mx=0
for j in a:
     i=j
     while i>0:
          l+=1
          i//=2
for p in permutations(a):
     p=list(p)
     s=[]
     for i in p:
          d=[]
          while i>0:
               d.append(i%2)
               i//=2
          d.reverse()
          for i in d:
               s.append(i)
     v=0
     j=1
     for i in s:
          v+=i*2**(l-j)
          j+=1
     mx=max(mx,v)
print(mx)