28442023-01-29 19:22:38VMGoJoNomekoppython3Time limit exceeded 0/10017ms6700 KiB
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()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Time limit exceeded16ms3896 KiB
subtask20/10
2Time limit exceeded14ms4128 KiB
3Time limit exceeded14ms4340 KiB
subtask30/30
4Time limit exceeded16ms4552 KiB
5Time limit exceeded16ms4696 KiB
6Time limit exceeded16ms4972 KiB
7Time limit exceeded16ms5184 KiB
8Time limit exceeded16ms5152 KiB
9Time limit exceeded16ms5332 KiB
subtask40/20
10Time limit exceeded17ms5480 KiB
11Time limit exceeded17ms5564 KiB
12Time limit exceeded17ms5904 KiB
13Time limit exceeded17ms5780 KiB
subtask50/40
14Time limit exceeded17ms6480 KiB
15Time limit exceeded17ms6436 KiB
16Time limit exceeded17ms6488 KiB
17Time limit exceeded17ms6316 KiB
18Time limit exceeded17ms6508 KiB
19Time limit exceeded17ms6508 KiB
20Time limit exceeded17ms6560 KiB
21Time limit exceeded17ms6700 KiB