28372023-01-29 19:14:19VMGoJoNomekoppython3Time limit exceeded 0/10017ms6420 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 exceeded16ms3712 KiB
subtask20/10
2Time limit exceeded14ms4064 KiB
3Time limit exceeded14ms4312 KiB
subtask30/30
4Time limit exceeded14ms4232 KiB
5Time limit exceeded17ms4500 KiB
6Time limit exceeded17ms4756 KiB
7Time limit exceeded16ms4672 KiB
8Time limit exceeded16ms4936 KiB
9Time limit exceeded16ms4888 KiB
subtask40/20
10Time limit exceeded17ms4960 KiB
11Time limit exceeded17ms5228 KiB
12Time limit exceeded16ms5232 KiB
13Time limit exceeded17ms5432 KiB
subtask50/40
14Time limit exceeded17ms5780 KiB
15Time limit exceeded17ms6036 KiB
16Time limit exceeded17ms5984 KiB
17Time limit exceeded17ms6068 KiB
18Time limit exceeded17ms6248 KiB
19Time limit exceeded17ms6176 KiB
20Time limit exceeded17ms6240 KiB
21Time limit exceeded17ms6420 KiB