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]
b=powers[1]
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)
diffs.append((l-k)/(a-b))
powers_sorted:list[int]=powers.copy()
powers_sorted.sort()
final_setup:list[int]=[]
#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.pop(loc_found)
final_setup.append(powers_sorted.pop(loc_found))
#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 | 3784 KiB | ||||
subtask2 | 0/10 | ||||||
2 | Time limit exceeded | 14ms | 3980 KiB | ||||
3 | Time limit exceeded | 14ms | 4068 KiB | ||||
subtask3 | 0/30 | ||||||
4 | Time limit exceeded | 14ms | 4256 KiB | ||||
5 | Time limit exceeded | 16ms | 4532 KiB | ||||
6 | Time limit exceeded | 14ms | 4744 KiB | ||||
7 | Time limit exceeded | 16ms | 4632 KiB | ||||
8 | Time limit exceeded | 14ms | 4748 KiB | ||||
9 | Time limit exceeded | 16ms | 4832 KiB | ||||
subtask4 | 0/20 | ||||||
10 | Time limit exceeded | 16ms | 4940 KiB | ||||
11 | Time limit exceeded | 16ms | 4868 KiB | ||||
12 | Time limit exceeded | 16ms | 5060 KiB | ||||
13 | Time limit exceeded | 16ms | 5208 KiB | ||||
subtask5 | 0/40 | ||||||
14 | Time limit exceeded | 17ms | 5464 KiB | ||||
15 | Time limit exceeded | 17ms | 5528 KiB | ||||
16 | Time limit exceeded | 17ms | 5472 KiB | ||||
17 | Time limit exceeded | 17ms | 5412 KiB | ||||
18 | Time limit exceeded | 17ms | 5724 KiB | ||||
19 | Time limit exceeded | 17ms | 5808 KiB | ||||
20 | Time limit exceeded | 17ms | 5880 KiB | ||||
21 | Time limit exceeded | 17ms | 6204 KiB |