結果

問題 No.2124 Guess the Permutation
ユーザー shobonvipshobonvip
提出日時 2022-11-18 21:34:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,780 KB
実行使用メモリ 84,120 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 06:20:48
合計ジャッジ時間 1,893 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
69,656 KB
testcase_01 AC 60 ms
69,656 KB
testcase_02 AC 60 ms
69,656 KB
testcase_03 AC 59 ms
69,656 KB
testcase_04 AC 63 ms
69,656 KB
testcase_05 AC 64 ms
69,656 KB
testcase_06 AC 95 ms
79,308 KB
testcase_07 AC 123 ms
84,120 KB
testcase_08 AC 123 ms
84,120 KB
testcase_09 AC 123 ms
84,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ans = [0] * n
tmp = 0
for i in range(n-1):
	if i == 0:
		print(f"? 2 {n}")
		g = int(input())
		ans[0] = n*(n+1)//2 - g
		tmp = ans[0]
	else:
		print(f"? 1 {i+1}")
		g = int(input())
		ans[i] = g - tmp
		tmp = g

ans[n-1] = n*(n+1)//2 - sum(ans)
print("!", *ans)
0