28352023-01-29 11:27:23VMGoJoNomekoppython3Time limit exceeded 0/10017ms6580 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]
    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()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Time limit exceeded16ms3768 KiB
subtask20/10
2Time limit exceeded14ms4008 KiB
3Time limit exceeded16ms4496 KiB
subtask30/30
4Time limit exceeded14ms4604 KiB
5Time limit exceeded16ms4496 KiB
6Time limit exceeded17ms4644 KiB
7Time limit exceeded16ms4880 KiB
8Time limit exceeded16ms5024 KiB
9Time limit exceeded16ms4980 KiB
subtask40/20
10Time limit exceeded16ms5348 KiB
11Time limit exceeded16ms5576 KiB
12Time limit exceeded16ms5584 KiB
13Time limit exceeded16ms5664 KiB
subtask50/40
14Time limit exceeded17ms6048 KiB
15Time limit exceeded17ms5996 KiB
16Time limit exceeded17ms6128 KiB
17Time limit exceeded17ms6028 KiB
18Time limit exceeded17ms6156 KiB
19Time limit exceeded17ms6224 KiB
20Time limit exceeded17ms6580 KiB
21Time limit exceeded17ms6468 KiB