結果

問題 No.2124 Guess the Permutation
ユーザー 👑 KA37RI
提出日時 2023-10-27 08:34:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,480 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-09-25 12:56:00
合計ジャッジ時間 1,548 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ans = [0] * n
print(f"? 2 {n}")
lst = n * (n + 1) // 2
ans[0] = n * (n + 1) // 2 - int(input())
sm = ans[0]
for i in range(n - 2):
	print(f"? {i+1} {i+2}")
	ans[i+1] = int(input()) - ans[i]
	sm += ans[i+1]
ans[-1] = n * (n + 1) // 2 - sm
print("!", *ans)
	
0