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 | 3768 KiB | ||||
subtask2 | 0/10 | ||||||
2 | Time limit exceeded | 14ms | 4008 KiB | ||||
3 | Time limit exceeded | 16ms | 4496 KiB | ||||
subtask3 | 0/30 | ||||||
4 | Time limit exceeded | 14ms | 4604 KiB | ||||
5 | Time limit exceeded | 16ms | 4496 KiB | ||||
6 | Time limit exceeded | 17ms | 4644 KiB | ||||
7 | Time limit exceeded | 16ms | 4880 KiB | ||||
8 | Time limit exceeded | 16ms | 5024 KiB | ||||
9 | Time limit exceeded | 16ms | 4980 KiB | ||||
subtask4 | 0/20 | ||||||
10 | Time limit exceeded | 16ms | 5348 KiB | ||||
11 | Time limit exceeded | 16ms | 5576 KiB | ||||
12 | Time limit exceeded | 16ms | 5584 KiB | ||||
13 | Time limit exceeded | 16ms | 5664 KiB | ||||
subtask5 | 0/40 | ||||||
14 | Time limit exceeded | 17ms | 6048 KiB | ||||
15 | Time limit exceeded | 17ms | 5996 KiB | ||||
16 | Time limit exceeded | 17ms | 6128 KiB | ||||
17 | Time limit exceeded | 17ms | 6028 KiB | ||||
18 | Time limit exceeded | 17ms | 6156 KiB | ||||
19 | Time limit exceeded | 17ms | 6224 KiB | ||||
20 | Time limit exceeded | 17ms | 6580 KiB | ||||
21 | Time limit exceeded | 17ms | 6468 KiB |