結果

問題 No.2124 Guess the Permutation
ユーザー lloyzlloyz
提出日時 2022-11-18 21:25:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 11,780 KB
実行使用メモリ 26,476 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 06:12:32
合計ジャッジ時間 1,790 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
26,388 KB
testcase_01 AC 49 ms
26,388 KB
testcase_02 AC 53 ms
26,388 KB
testcase_03 AC 51 ms
26,388 KB
testcase_04 AC 55 ms
26,392 KB
testcase_05 AC 54 ms
26,392 KB
testcase_06 AC 77 ms
26,432 KB
testcase_07 AC 93 ms
26,476 KB
testcase_08 AC 92 ms
26,476 KB
testcase_09 AC 93 ms
26,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

sumP = n * (n + 1) // 2
ANS = [0 for _ in range(n)]
res = 0
for i in range(n - 2):
    print(f"? {i + 2} {n}")
    s = int(input())
    ANS[i] = sumP - s - res
    res += ANS[i]
print(f"? {1} {n - 1}")
s = int(input())
ANS[n - 1] = sumP - s
ANS[n - 2] = sumP - res - ANS[n - 1]
print(f"! {' '.join(map(str, ANS))}")
0