107952024-04-13 22:54:04pythonNomekoppypy3Elfogadva 100/1001.529s180028 KiB
import sys
input=sys.stdin.readline

def solv():
    n = int(input())
    N = list(map(int, input().split()))
    if n==1:
        print('!',*N)
        sys.stdout.flush()
        return
    N.sort()
    NN=N[:]
    if N[0]==N[-1]:
        print('!',*N)
        sys.stdout.flush()
        return
    A=[0]*n
    print('?',*N)
    sys.stdout.flush()
    ans = int(input())
    N[0],N[-1]=N[-1],N[0]
    M=N[:]
    print('?',*N)
    sys.stdout.flush()
    newans = int(input())
    A[0]=(ans-newans)//(N[-1]-N[0])
    done=2
    i=0
    last=newans
    while done<n and N[i] != N[i+1]:
        N[i],N[i+1]=N[i+1],N[i]
        print('?',*N)
        sys.stdout.flush()
        new = int(input())
        A[i+1]=A[i]-(last-new)//(N[i+1]-N[i])
        done+=1
        i+=1
        last=new
    i=n-1
    last=newans
    while done<n and M[i] != M[i-1]:
        M[i],M[i-1]=M[i-1],M[i]
        print('?',*M)
        sys.stdout.flush()
        new = int(input())
        A[i-1]=A[i]-(last-new)//(M[i-1]-M[i])
        done+=1
        i-=1
        last=new
    #print(A)
    # NN sorted
    AA=[(A[i],i) for i in range(n)]
    AA.sort()
    for i in range(n):
        N[AA[i][1]]=NN[i]
    print('!',*N)
    sys.stdout.flush()
    return

solv()
exit()

RészfeladatÖsszpontTesztVerdiktIdőMemória
subtask10/0
1Elfogadva43ms77176 KiB
subtask210/10
2Elfogadva41ms77548 KiB
3Elfogadva41ms77828 KiB
subtask330/30
4Elfogadva57ms87480 KiB
5Elfogadva105ms88464 KiB
6Elfogadva101ms88764 KiB
7Elfogadva98ms88604 KiB
8Elfogadva59ms88132 KiB
9Elfogadva98ms89260 KiB
subtask420/20
10Elfogadva157ms93984 KiB
11Elfogadva159ms93764 KiB
12Elfogadva168ms94176 KiB
13Elfogadva163ms94280 KiB
subtask540/40
14Elfogadva1.529s180028 KiB
15Elfogadva1.493s179788 KiB
16Elfogadva1.348s178844 KiB
17Elfogadva1.24s179392 KiB
18Elfogadva1.412s178708 KiB
19Elfogadva1.414s178428 KiB
20Elfogadva1.411s178540 KiB
21Elfogadva1.371s178876 KiB