from sys import stdin, stdout
def main():
n:int=int(stdin.readline())
powers=stdin.readline().split()
powers = [int(i) for i in powers]
def test_setup(p_in:list[int]) ->int:
stdout.write("? "+" ".join(map(str, p_in)))
stdout.flush()
return int(stdin.readline())
a=powers[0]
diffs:list[int]=[0]
l=test_setup(powers)
for i in range(1,n):
#SWAP
b=powers[i]
new_setup=powers.copy()
new_setup[0],new_setup[i]=powers[i],powers[0]
k=test_setup(new_setup)
if l-k==0:
diffs.append(0)
else:
diffs.append((l-k)/(b-a))
powers_sorted:list[int]=powers.copy()
powers_sorted.sort(reverse=True)
final_setup:list[int]=[0]*len(diffs)
print(diffs)
for i in range(len(diffs.copy())):
loc_found:int
szelsoertek:int=-1000000000000000000000000000
for j in range(len(diffs)):
if diffs[j]>szelsoertek:
loc_found=j
szelsoertek=diffs[j]
#print("temp found "+str(diffs[j]))
#print("found "+str(diffs[loc_found]))
diffs[loc_found]=-1000000000000000000000000000
final_setup[loc_found]=powers_sorted[i]
#WRITE FINAL
stdout.write("! "+" ".join(map(str, final_setup)))
stdout.flush()
exit(0)
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Time limit exceeded | 16ms | 3896 KiB | ||||
subtask2 | 0/10 | ||||||
2 | Time limit exceeded | 14ms | 4128 KiB | ||||
3 | Time limit exceeded | 14ms | 4340 KiB | ||||
subtask3 | 0/30 | ||||||
4 | Time limit exceeded | 16ms | 4552 KiB | ||||
5 | Time limit exceeded | 16ms | 4696 KiB | ||||
6 | Time limit exceeded | 16ms | 4972 KiB | ||||
7 | Time limit exceeded | 16ms | 5184 KiB | ||||
8 | Time limit exceeded | 16ms | 5152 KiB | ||||
9 | Time limit exceeded | 16ms | 5332 KiB | ||||
subtask4 | 0/20 | ||||||
10 | Time limit exceeded | 17ms | 5480 KiB | ||||
11 | Time limit exceeded | 17ms | 5564 KiB | ||||
12 | Time limit exceeded | 17ms | 5904 KiB | ||||
13 | Time limit exceeded | 17ms | 5780 KiB | ||||
subtask5 | 0/40 | ||||||
14 | Time limit exceeded | 17ms | 6480 KiB | ||||
15 | Time limit exceeded | 17ms | 6436 KiB | ||||
16 | Time limit exceeded | 17ms | 6488 KiB | ||||
17 | Time limit exceeded | 17ms | 6316 KiB | ||||
18 | Time limit exceeded | 17ms | 6508 KiB | ||||
19 | Time limit exceeded | 17ms | 6508 KiB | ||||
20 | Time limit exceeded | 17ms | 6560 KiB | ||||
21 | Time limit exceeded | 17ms | 6700 KiB |