import sys
input=sys.stdin.readline
def solv():
n = int(input())
N = list(map(int, input().split()))
if n==1:
print('!',*N)
sys.stdout.flush()
return
N.sort()
NN=N[:]
if N[0]==N[-1]:
print('!',*N)
sys.stdout.flush()
return
A=[0]*n
print('?',*N)
sys.stdout.flush()
ans = int(input())
N[0],N[-1]=N[-1],N[0]
M=N[:]
print('?',*N)
sys.stdout.flush()
newans = int(input())
A[0]=(ans-newans)//(N[-1]-N[0])
done=2
i=0
last=newans
while done<n and N[i] != N[i+1]:
N[i],N[i+1]=N[i+1],N[i]
print('?',*N)
sys.stdout.flush()
new = int(input())
A[i+1]=A[i]-(last-new)//(N[i+1]-N[i])
done+=1
i+=1
last=new
i=n-1
last=newans
while done<n and M[i] != M[i-1]:
M[i],M[i-1]=M[i-1],M[i]
print('?',*M)
sys.stdout.flush()
new = int(input())
A[i-1]=A[i]-(last-new)//(M[i-1]-M[i])
done+=1
i-=1
last=new
#print(A)
# NN sorted
AA=[(A[i],i) for i in range(n)]
AA.sort()
for i in range(n):
N[AA[i][1]]=NN[i]
print('!',*N)
sys.stdout.flush()
return
solv()
exit()
Részfeladat | Összpont | Teszt | Verdikt | Idő | Memória | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Elfogadva | 43ms | 77176 KiB | ||||
subtask2 | 10/10 | ||||||
2 | Elfogadva | 41ms | 77548 KiB | ||||
3 | Elfogadva | 41ms | 77828 KiB | ||||
subtask3 | 30/30 | ||||||
4 | Elfogadva | 57ms | 87480 KiB | ||||
5 | Elfogadva | 105ms | 88464 KiB | ||||
6 | Elfogadva | 101ms | 88764 KiB | ||||
7 | Elfogadva | 98ms | 88604 KiB | ||||
8 | Elfogadva | 59ms | 88132 KiB | ||||
9 | Elfogadva | 98ms | 89260 KiB | ||||
subtask4 | 20/20 | ||||||
10 | Elfogadva | 157ms | 93984 KiB | ||||
11 | Elfogadva | 159ms | 93764 KiB | ||||
12 | Elfogadva | 168ms | 94176 KiB | ||||
13 | Elfogadva | 163ms | 94280 KiB | ||||
subtask5 | 40/40 | ||||||
14 | Elfogadva | 1.529s | 180028 KiB | ||||
15 | Elfogadva | 1.493s | 179788 KiB | ||||
16 | Elfogadva | 1.348s | 178844 KiB | ||||
17 | Elfogadva | 1.24s | 179392 KiB | ||||
18 | Elfogadva | 1.412s | 178708 KiB | ||||
19 | Elfogadva | 1.414s | 178428 KiB | ||||
20 | Elfogadva | 1.411s | 178540 KiB | ||||
21 | Elfogadva | 1.371s | 178876 KiB |