結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
26,488 KB
testcase_01 AC 52 ms
26,488 KB
testcase_02 AC 50 ms
26,488 KB
testcase_03 AC 50 ms
26,488 KB
testcase_04 AC 52 ms
26,488 KB
testcase_05 AC 54 ms
26,492 KB
testcase_06 AC 72 ms
26,536 KB
testcase_07 AC 91 ms
26,600 KB
testcase_08 AC 90 ms
26,600 KB
testcase_09 AC 91 ms
26,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ask(l, r):
    print("?", l+1, r, flush=True)
    return int(input())

n = int(input())
ans = [0]*n
s = n*(n+1)//2
ans[-1] = s-ask(0, n-1)
for i in range(n-2):
    ans[i] = s-ask(i+1, n)
    s -= ans[i]

ans[-2] = n*(n+1)//2-sum(ans)

print("!", *ans)
0