read = True
if read:
N = int(input())
P = [int(x) for x in input().split()]
else:
N = 5
P = [3, 2, 3, 1, 5]
P.sort()
def ask(t):
if read:
print('?', *t)
return int(input())
else:
c = [4, 4, 1, 1, 2]
s = 0
for a, b in zip(t, c):
s += a * b
return s
base1 = ask(P)
P[0], P[-1] = P[-1], P[0]
base2 = ask(P)
P[0], P[-1] = P[-1], P[0]
D = [0]*N
for i in range(1, N):
if P[0] == P[i]:
P[0], P[-1] = P[-1], P[0]
used = base2
else:
used = base1
P[0], P[i] = P[i], P[0]
new = ask(P)
P[0], P[i] = P[i], P[0]
# (P0A0 + PiAi) - (P0Ai + PiA0)
# = A0(P0-Pi) + Ai(Pi-P0)
# = A0(P0-Pi) - Ai(P0-Pi)
# = (A0-Ai)(P0-Pi)
# = (Ai-A0)(Pi-P0)
D[i] = (used - new) // (P[i] - P[0])
if used == base2:
P[0], P[-1] = P[-1], P[0]
I = [b for a,b in sorted(zip(D, range(N)))]
R = [None]*N
for p, i in zip(P, I):
R[i] = p
print('!', *R)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11504 KiB | ||||
subtask2 | 10/10 | ||||||
2 | Accepted | 18ms | 11924 KiB | ||||
3 | Accepted | 17ms | 12196 KiB | ||||
subtask3 | 30/30 | ||||||
4 | Accepted | 23ms | 12432 KiB | ||||
5 | Accepted | 107ms | 12420 KiB | ||||
6 | Accepted | 105ms | 12720 KiB | ||||
7 | Accepted | 105ms | 12732 KiB | ||||
8 | Accepted | 21ms | 12740 KiB | ||||
9 | Accepted | 108ms | 13048 KiB | ||||
subtask4 | 20/20 | ||||||
10 | Accepted | 351ms | 13392 KiB | ||||
11 | Accepted | 363ms | 13456 KiB | ||||
12 | Accepted | 356ms | 13784 KiB | ||||
13 | Accepted | 358ms | 13860 KiB | ||||
subtask5 | 0/40 | ||||||
14 | Time limit exceeded | 5.046s | 6204 KiB | ||||
15 | Time limit exceeded | 5.066s | 6236 KiB | ||||
16 | Accepted | 4.691s | 15404 KiB | ||||
17 | Accepted | 4.083s | 15116 KiB | ||||
18 | Time limit exceeded | 5.013s | 6424 KiB | ||||
19 | Time limit exceeded | 5.026s | 6368 KiB | ||||
20 | Time limit exceeded | 5.021s | 6636 KiB | ||||
21 | Time limit exceeded | 5.028s | 6412 KiB |