結果

問題 No.2124 Guess the Permutation
ユーザー titia
提出日時 2022-11-18 21:30:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,480 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-09-20 01:55:04
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())


SUM=(N+1)*N//2

ANS=[0]*N

NOW=SUM
for i in range(N-2):
    print("?",i+2,N,flush=True)
    x=int(input())

    ANS[i]=NOW-x
    NOW-=ANS[i]
    
    
print("?",N-2,N-1,flush=True)
x=int(input())

ANS[-2]=x-ANS[-3]
ANS[-1]=SUM-sum(ANS)

print("!",*ANS,flush=True)
0