結果

問題 No.2124 Guess the Permutation
ユーザー ntuda
提出日時 2025-07-03 09:04:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 88,356 KB
平均クエリ数 374.60
最終ジャッジ日時 2025-07-03 09:04:30
合計ジャッジ時間 2,517 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
SP = N * (N+1) //2
P = [0] * N
AP = [0] * N
print("?",2,N)
S = int(input())
P[0] = SP - S
AP[0] = P[0]
SP -= P[0]
for i in range(2,N):
    print("?",1,i)
    S = int(input())
    AP[i-1] = S
    P[i-1] = AP[i-1] - AP[i - 2]
    SP -= P[i-1]
P[N-1] = SP
print("!",*P)
0